Exemple #1
0
        double getSatDensityAtTemp(double tempK, LiqGasProperties props)
        {
            double tau   = 1 - tempK;
            double tau35 = Math.Pow(tau, 0.35);
            double tau2  = tau * tau;
            double tau3  = tau * tau2;
            double tau65 = Math.Pow(tau, 0.65);
            double dens  = props.densCrit * (1 + (props.k1 * tau35 + props.k3 * tau2 + props.k4 * tau3) / (1 + props.k2 * tau65));

            return(dens);
        }
Exemple #2
0
        // API 11.2.4 Section 5.1.1.3
        // Temperature compensation CTL
        public double GetCTLLiqGas(double tempF, double api60)
        {
            // Step T24/3
            // Check Density and Temperature range
            COMMODITY_GROUP grp = COMMODITY_GROUP.LPG_NGL;

            checkRange(api60, "API", grp);
            checkRange(tempF, "degF", grp);             // Group must be specified

            // Step T24/2
            // Convert temp to Kelvin and roundup
            tempF = RoundUp(tempF, -1);
            double Tx = Conversions.DegFtoDegK(tempF);

            // Convert to relative density and roundup
            double relDens60 = Conversions.APItoSG(api60);

            relDens60 = RoundUp(relDens60, -4);

            // Step T24/4
            // Chose reference fluid subscripts (1,2)
            LiqGasProperties f1   = null;
            LiqGasProperties f2   = null;
            LiqGasProperties prev = null;

            foreach (var lgProp in lgProps)
            {
                if (prev != null)
                {
                    if (lgProp.Value.relDens60 >= relDens60)
                    {
                        f2 = lgProp.Value;
                        f1 = prev;
                        break;
                    }
                }
                prev = lgProp.Value;
            }
            if (f2 == null || f1 == null)
            {
                throw (new ArgumentException(String.Format("Relative density {0} is out of the range of API 11.2.4 Table 1", api60)));
            }

            // Step T24/5
            // Compute interpolation variable
            double delta = (relDens60 - f1.relDens60) / (f2.relDens60 - f1.relDens60);

            // Step T24/6
            // Compute interpolated critical temperature
            double Tc = f1.tempCritK + delta * (f2.tempCritK - f1.tempCritK);

            // Step T24/7
            // Compute reduced temperature ratio
            double Trx = Tx / Tc;

            if (Trx > 1)
            {
                throw (new ArgumentException(String.Format("Temperature {0} will result in supercritical conditions which are not supported by this computation", tempF)));
            }

            // Step 24/8
            // Compute reduced temperature at 60F
            double t60K = Conversions.DegFtoDegK(60);
            double Tr60 = t60K / Tc;

            // Step 24/9
            // Compute scaling factor
            double h2 = (f1.comprFactCrit * f1.densCrit) / (f2.comprFactCrit * f2.densCrit);

            // Step 24/10
            // Compute saturation density of both fluids at 60F
            double dens60_1 = getSatDensityAtTemp(Tr60, f1);
            double dens60_2 = getSatDensityAtTemp(Tr60, f2);

            // Step 24/11
            // Calculate interpolating factor
            Func <double, double, double> ratio = (dens1, dens2) => dens1 / (1 + delta * (dens1 / (h2 * dens2) - 1));
            double X = ratio(dens60_1, dens60_2);

            // Step 24/12
            // Opbtain saturation density of both fluids at Trx
            double densX_1 = getSatDensityAtTemp(Trx, f1);
            double densX_2 = getSatDensityAtTemp(Trx, f2);

            // Step 24/13
            // Obtain CTL
            double CTL = ratio(densX_1, densX_2) / X;

            return(CTL);
        }
        public static Dictionary <LIQ_GAS_FLUID, LiqGasProperties> GetLiqGasProperties()
        {
            Dictionary <LIQ_GAS_FLUID, LiqGasProperties> props = new Dictionary <LIQ_GAS_FLUID, LiqGasProperties>();

            // EE(68/32)
            LiqGasProperties props1 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.EE_68_32,
                relDens60     = 0.325022,
                tempCritK     = 298.11,
                comprFactCrit = 0.27998,
                densCrit      = 6.250,
                k1            = 2.54616855327,
                k2            = -0.058244177754,
                k3            = 0.803398090807,
                k4            = -0.745720314137
            };

            props.Add(props1.Fluid, props1);
            // Ethane
            LiqGasProperties props2 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.ETHANE,
                relDens60     = 0.355994,
                tempCritK     = 305.33,
                comprFactCrit = 0.28220,
                densCrit      = 6.870,
                k1            = 1.89113042610,
                k2            = -0.370305782347,
                k3            = -0.544867288720,
                k4            = 0.337876634952
            };

            props.Add(props2.Fluid, props2);
            // EP(65/35)
            LiqGasProperties props3 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.EP_65_35,
                relDens60     = 0.429277,
                tempCritK     = 333.67,
                comprFactCrit = 0.28060,
                densCrit      = 5.615,
                k1            = 2.20970078464,
                k2            = -0.294253708172,
                k3            = -0.405754420098,
                k4            = 0.319443433421
            };

            props.Add(props3.Fluid, props3);
            // EP(35/65)
            LiqGasProperties props4 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.EP_35_65,
                relDens60     = 0.470381,
                tempCritK     = 352.46,
                comprFactCrit = 0.27930,
                densCrit      = 5.110,
                k1            = 2.25341981320,
                k2            = -0.266542138024,
                k3            = -0.372756711655,
                k4            = 0.384734185665
            };

            props.Add(props4.Fluid, props4);
            // Propane
            LiqGasProperties props5 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.PROPANE,
                relDens60     = 0.507025,
                tempCritK     = 369.78,
                comprFactCrit = 0.27626,
                densCrit      = 5.000,
                k1            = 1.96568366933,
                k2            = -0.327662435541,
                k3            = -0.417979702538,
                k4            = 0.303271602831
            };

            props.Add(props5.Fluid, props5);
            // i-Butane
            LiqGasProperties props6 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.iBUTANE,
                relDens60     = 0.562827,
                tempCritK     = 407.85,
                comprFactCrit = 0.28326,
                densCrit      = 3.860,
                k1            = 2.04748034410,
                k2            = -0.289734363425,
                k3            = -0.330345036434,
                k4            = 0.291757103132
            };

            props.Add(props6.Fluid, props6);
            // n-Butane
            LiqGasProperties props7 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.nBUTANE,
                relDens60     = 0.584127,
                tempCritK     = 425.16,
                comprFactCrit = 0.27536,
                densCrit      = 3.920,
                k1            = 2.03734743118,
                k2            = -0.299059145695,
                k3            = -0.418883095671,
                k4            = 0.380367738748
            };

            props.Add(props7.Fluid, props7);
            // i-Pentane
            LiqGasProperties props8 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.iPENTANE,
                relDens60     = 0.624285,
                tempCritK     = 460.44,
                comprFactCrit = 0.27026,
                densCrit      = 3.247,
                k1            = 2.06541640707,
                k2            = -0.238366208840,
                k3            = -0.161440492247,
                k4            = 0.258681568613
            };

            props.Add(props8.Fluid, props8);
            // n-Pentane
            LiqGasProperties props9 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.nPENTANE,
                relDens60     = 0.631054,
                tempCritK     = 469.65,
                comprFactCrit = 0.27235,
                densCrit      = 3.200,
                k1            = 2.11263474494,
                k2            = -0.261269413560,
                k3            = -0.291923445075,
                k4            = 0.308344290017
            };

            props.Add(props9.Fluid, props9);
            // i-Hexane
            LiqGasProperties props10 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.iHEXANE,
                relDens60     = 0.657167,
                tempCritK     = 498.05,
                comprFactCrit = 0.26706,
                densCrit      = 2.727,
                k1            = 2.02382197871,
                k2            = -0.423550090067,
                k3            = -1.152810982570,
                k4            = 0.950139001678
            };

            props.Add(props10.Fluid, props10);
            // n-Hexane
            LiqGasProperties props11 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.nHEXANE,
                relDens60     = 0.664064,
                tempCritK     = 507.35,
                comprFactCrit = 0.26762,
                densCrit      = 2.704,
                k1            = 2.17134547773,
                k2            = -0.232997313405,
                k3            = -0.267019794036,
                k4            = 0.378629524102
            };

            props.Add(props11.Fluid, props11);
            // n-Heptane
            LiqGasProperties props12 = new LiqGasProperties()
            {
                Fluid         = LIQ_GAS_FLUID.nHEPTANE,
                relDens60     = 0.688039,
                tempCritK     = 540.15,
                comprFactCrit = 0.26312,
                densCrit      = 2.315,
                k1            = 2.19773533433,
                k2            = -0.275056764147,
                k3            = -0.447144095029,
                k4            = 0.493770995799
            };

            props.Add(props12.Fluid, props12);

            return(props);
        }