示例#1
0
        public FakeProperty(string name, FakeType propertyType, PropertyMethods propertyMethods, FakeAttribute[] attributes = null)
        {
            Name         = name;
            PropertyType = propertyType;
            Attributes   = attributes;

            switch (propertyMethods)
            {
            case PropertyMethods.HasGetOnly:
                GetMethod = new FakeMethod($"get_{name}", propertyType, null);
                break;

            case PropertyMethods.HasSetOnly:
                SetMethod = new FakeMethod($"set_{name}", null, new[] { new FakeParameter("value", propertyType) });
                break;

            case PropertyMethods.HasGetAndSet:
                GetMethod = new FakeMethod($"get_{name}", propertyType, null);
                SetMethod = new FakeMethod($"set_{name}", null, new[] { new FakeParameter("value", propertyType) });
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(propertyMethods), propertyMethods, null);
            }
        }
示例#2
0
        protected override void LoadChildren()
        {
            var propertyMethodNodes = PropertyMethods.OrderBy(x => x.Name)
                                      .Select(method => new PropertyMethodNode(method));

            Children.AddRange(propertyMethodNodes);
        }
示例#3
0
        private PropertyDeclaration PropInfoToDeclaration(PropertyInfo prop)
        {
            PropertyMethods method = PropertyMethods.Get;

            if (prop.CanRead && prop.CanWrite)
            {
                method = PropertyMethods.Both;
            }
            else if (prop.CanWrite)
            {
                method = PropertyMethods.Set;
            }

            return(new PropertyDeclaration(prop.Name, prop.PropertyType, method));
        }
示例#4
0
        Dictionary <string, Compound> GenerateCompounds(IUnitsOfMeasure su)
        {
            //generate pseudos from number or temperature cuts

            int i      = 0;
            int method = pseudomode;

            double[] tbp2 = null;
            double[] tbpx = null;

            var fittedt = new List <double>();

            double[] coeff;
            object[] obj = null;
            double   Tmin, Tmax;

            //generate polynomial from input data

            if (tbpcurvetype == 0)
            {
                //tbp
                tbp2 = tbp.ToArray();
                tbpx = cb.ToArray();
            }
            else if (tbpcurvetype == 1)
            {
                //d86
                double T0   = 0;
                double T10  = 0;
                double T30  = 0;
                double T50  = 0;
                double T70  = 0;
                double T90  = 0;
                double T100 = 0;
                //interpolate to obtain points
                double[] w = null;
                ratinterpolation.buildfloaterhormannrationalinterpolant(cb.ToArray(), cb.Count, 1, ref w);
                T0   = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.0d);
                T10  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.1d);
                T30  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.3d);
                T50  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.5d);
                T70  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.7d);
                T90  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.9d);
                T100 = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 1.0d);
                //tbp
                tbp2 = DistillationCurveConversion.ASTMD86ToPEV_Riazi(new double[] { T0, T10, T30, T50, T70, T90, T100 });
                tbpx = new double[] { 1E-06, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0 };
            }
            else if (tbpcurvetype == 2)
            {
                //vacuum
                double T0   = 0;
                double T10  = 0;
                double T30  = 0;
                double T50  = 0;
                double T70  = 0;
                double T90  = 0;
                double T100 = 0;
                //interpolate to obtain points
                double[] w = null;
                ratinterpolation.buildfloaterhormannrationalinterpolant(cb.ToArray(), cb.Count, 1, ref w);
                T0   = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0);
                T10  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.1);
                T30  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.3);
                T50  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.5);
                T70  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.7);
                T90  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.9);
                T100 = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 1.0);
                //tbp
                tbp2 = DistillationCurveConversion.ASTMD1160ToPEVsub_Wauquier(new double[] { T0, T10, T30, T50, T70, T90, T100 });
                double K = 12.0;
                tbp2[0] = DistillationCurveConversion.PEVsubToPEV_MaxwellBonnel(tbp2[0], 1333, K);
                tbp2[1] = DistillationCurveConversion.PEVsubToPEV_MaxwellBonnel(tbp2[1], 1333, K);
                tbp[22] = DistillationCurveConversion.PEVsubToPEV_MaxwellBonnel(tbp2[2], 1333, K);
                tbp2[3] = DistillationCurveConversion.PEVsubToPEV_MaxwellBonnel(tbp2[3], 1333, K);
                tbp2[4] = DistillationCurveConversion.PEVsubToPEV_MaxwellBonnel(tbp2[4], 1333, K);
                tbp2[5] = DistillationCurveConversion.PEVsubToPEV_MaxwellBonnel(tbp2[5], 1333, K);
                tbp2[6] = DistillationCurveConversion.PEVsubToPEV_MaxwellBonnel(tbp2[6], 1333, K);
                tbpx    = new double[] { 1E-06, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0 };
            }
            else if (tbpcurvetype == 3)
            {
                //simulated
                double T5   = 0;
                double T10  = 0;
                double T30  = 0;
                double T50  = 0;
                double T70  = 0;
                double T90  = 0;
                double T95  = 0;
                double T100 = 0;
                //interpolate to obtain points
                double[] w = null;
                ratinterpolation.buildfloaterhormannrationalinterpolant(cb.ToArray(), cb.Count, 1, ref w);
                T5   = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.05);
                T10  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.1);
                T30  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.3);
                T50  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.5);
                T70  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.7);
                T90  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.9);
                T95  = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 0.95);
                T100 = polinterpolation.barycentricinterpolation(cb.ToArray(), tbp.ToArray(), w, cb.Count, 1.0);
                //tbp
                tbp2 = DistillationCurveConversion.ASTMD2887ToPEV_Daubert(new double[] { T5, T10, T30, T50, T70, T90, T95, T100 });
                tbpx = new double[] { 0.05, 0.1, 0.3, 0.5, 0.7, 0.9, 0.95, 1.0 };
            }

            Tmin = tbp2.Min();
            Tmax = tbp2.Max();

            //y = 10358x5 - 15934x4 + 11822x3 - 4720,2x2 + 1398,2x + 269,23
            //R² = 1

            double[] inest = new double[7];

            if (tbpcurvetype == 1)
            {
                double[] w2 = null;
                ratinterpolation.buildfloaterhormannrationalinterpolant(tbpx, tbpx.Length, 1, ref w2);
                inest[0] = polinterpolation.barycentricinterpolation(tbpx, tbp2, w2, tbpx.Length, 0);
            }
            else
            {
                inest[0] = Tmin;
            }
            inest[1] = 1398;
            inest[2] = 4720;
            inest[3] = 11821;
            inest[4] = 15933;
            inest[5] = 10358;
            inest[6] = -3000;

            DistillationCurveConversion.TBPFit lmfit = new DistillationCurveConversion.TBPFit();
            obj   = (object[])lmfit.GetCoeffs(tbpx, tbp2, inest, 1E-10, 1E-08, 1E-08, 1000);
            coeff = (double[])obj[0];

            //TBP(K) = aa + bb*fv + cc*fv^2 + dd*fv^3 + ee*fv^4 + ff*fv^5 (fv 0 ~ 1)

            fittedt.Clear();
            for (i = 0; i <= tbp2.Length - 1; i++)
            {
                fittedt.Add(cv.ConvertFromSI(su.temperature, coeff[0] + coeff[1] * tbpx[i] + coeff[2] * Math.Pow(tbpx[i], 2) + coeff[3] * Math.Pow(tbpx[i], 3) + coeff[4] * Math.Pow(tbpx[i], 4) + coeff[5] * Math.Pow(tbpx[i], 5) + coeff[6] * Math.Pow(tbpx[i], 6)));
            }

            //create pseudos

            if (method == 0)
            {
                int    np     = Convert.ToInt32(pseudocuts);
                double deltaT = (Tmax - Tmin) / (np);
                double t0     = 0;
                double fv0    = 0;
                t0  = Tmin;
                fv0 = tbpx.Min();
                tccol.Clear();
                for (i = 0; i <= np - 1; i++)
                {
                    tmpcomp tc = new tmpcomp();
                    tc.tbp0 = t0;
                    tc.tbpf = t0 + deltaT;
                    tc.fv0  = GetFV(coeff, fv0, tc.tbp0);
                    tc.fvf  = GetFV(coeff, fv0, tc.tbpf);
                    tc.fvm  = tc.fv0 + (tc.fvf - tc.fv0) / 2;
                    tc.tbpm = GetT(coeff, tc.fvm);
                    tccol.Add(tc);
                    t0  = t0 + deltaT;
                    fv0 = tc.fvf;
                }
            }
            else
            {
                int    np  = cuttemps.Count + 1;
                double t0  = 0;
                double fv0 = 0;
                t0  = Tmin;
                fv0 = tbpx.Min();
                tccol.Clear();
                for (i = 0; i <= np - 1; i++)
                {
                    tmpcomp tc = new tmpcomp();
                    tc.tbp0 = t0;
                    if (i == np - 1)
                    {
                        tc.tbpf = Tmax;
                    }
                    else
                    {
                        tc.tbpf = cv.ConvertToSI(su.temperature, cuttemps[i]);
                    }
                    tc.fv0  = GetFV(coeff, fv0, tc.tbp0);
                    tc.fvf  = GetFV(coeff, fv0, tc.tbpf);
                    tc.fvm  = tc.fv0 + (tc.fvf - tc.fv0) / 2;
                    tc.tbpm = GetT(coeff, tc.fvm);
                    tccol.Add(tc);
                    fv0 = tc.fvf;
                    if (i < np - 1)
                    {
                        t0 = cv.ConvertToSI(su.temperature, cuttemps[i]);
                    }
                }
            }

            DWSIM.Thermodynamics.Utilities.PetroleumCharacterization.Methods.GL methods2 = new DWSIM.Thermodynamics.Utilities.PetroleumCharacterization.Methods.GL();

            Dictionary <string, Compound> ccol = new Dictionary <string, Compound>();

            i = 0;

            foreach (tmpcomp tc in tccol)
            {
                ConstantProperties cprops = new ConstantProperties();

                cprops.NBP        = tc.tbpm;
                cprops.OriginalDB = "Petroleum Assay: " + assayname;
                cprops.CurrentDB  = "Petroleum Assay: " + assayname;
                cprops.Name       = assayname + "_" + (i + 1).ToString();

                //SG
                if (!hassgc)
                {
                    if (Math.Abs(cprops.PF_MM.GetValueOrDefault()) < 1e-10)
                    {
                        cprops.PF_MM = Math.Pow((1 / 0.01964 * (6.97996 - Math.Log(1080 - cprops.NBP.GetValueOrDefault()))), (3 / 2));
                    }
                    cprops.PF_SG = PropertyMethods.d15_Riazi(cprops.PF_MM.GetValueOrDefault());
                }
                else
                {
                    double[] w = null;
                    ratinterpolation.buildfloaterhormannrationalinterpolant(this.cb.ToArray(), cb.Count, 1, ref w);
                    cprops.PF_SG = polinterpolation.barycentricinterpolation(cb.ToArray(), sgc.ToArray(), w, cb.Count(), tc.fvm);
                }

                //MW
                if (!hasmwc)
                {
                    switch (type)
                    {
                    case SampleType.Light:
                        cprops.PF_MM = PropertyMethods.MW_Winn(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                        break;

                    case SampleType.Average:
                        cprops.PF_MM = PropertyMethods.MW_Riazi(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                        break;

                    case SampleType.Heavy:
                        cprops.PF_MM = PropertyMethods.MW_LeeKesler(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                        break;
                    }
                }
                else
                {
                    double[] w = null;
                    ratinterpolation.buildfloaterhormannrationalinterpolant(this.cb.ToArray(), cb.Count(), 1, ref w);
                    cprops.PF_MM = polinterpolation.barycentricinterpolation(this.cb.ToArray(), mwc.ToArray(), w, cb.Count(), tc.fvm);
                }

                cprops.Molar_Weight = cprops.PF_MM.GetValueOrDefault();

                i += 1;

                Compound subst = new Compound(cprops.Name, "");

                subst.ConstantProperties = cprops;
                subst.Name = cprops.Name;
                subst.PetroleumFraction = true;

                ccol.Add(cprops.Name, subst);
            }

            CalculateMolarFractions(ccol);

            if (mwb > 1E-10)
            {
                double mixtMW = 0;
                foreach (var c in ccol.Values)
                {
                    mixtMW += c.MoleFraction.GetValueOrDefault() * c.ConstantProperties.Molar_Weight;
                }
                double facm = mwb / mixtMW;
                foreach (var c in ccol.Values)
                {
                    c.ConstantProperties.Molar_Weight *= facm;
                }
            }

            if (sgb > 1E-10)
            {
                double mixtD = 0;
                foreach (var c in ccol.Values)
                {
                    mixtD += c.MassFraction.GetValueOrDefault() * c.ConstantProperties.PF_SG.GetValueOrDefault();
                }
                double facd = 141.5 / (131.5 + sgb) / mixtD;
                foreach (var c in ccol.Values)
                {
                    c.ConstantProperties.PF_SG *= facd;
                }
            }

            i = 0;

            foreach (var subst in ccol.Values)
            {
                ConstantProperties cprops = (ConstantProperties)subst.ConstantProperties;

                tmpcomp tc = tccol[i];

                //VISC
                if (!hasvisc100c)
                {
                    cprops.PF_Tv1 = 311;
                    cprops.PF_Tv2 = 372;
                    cprops.PF_v1  = PropertyMethods.Visc37_Abbott(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                    cprops.PF_v2  = PropertyMethods.Visc98_Abbott(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                }
                else
                {
                    double[] w = null;
                    ratinterpolation.buildfloaterhormannrationalinterpolant(cb.ToArray(), visc100.Count, 1, ref w);
                    cprops.PF_v1 = polinterpolation.barycentricinterpolation(cb.ToArray(), visc100.ToArray(), w, cb.Count, tc.fvm);
                    ratinterpolation.buildfloaterhormannrationalinterpolant(cb.ToArray(), visc210.Count, 1, ref w);
                    cprops.PF_v2  = polinterpolation.barycentricinterpolation(cb.ToArray(), visc210.ToArray(), w, cb.Count, tc.fvm);
                    cprops.PF_Tv1 = (100 - 32) / 9 * 5 + 273.15;
                    cprops.PF_Tv2 = (210 - 32) / 9 * 5 + 273.15;
                }

                cprops.PF_vA = PropertyMethods.ViscWaltherASTM_A(cprops.PF_Tv1.GetValueOrDefault(), cprops.PF_v1.GetValueOrDefault(), cprops.PF_Tv2.GetValueOrDefault(), cprops.PF_v2.GetValueOrDefault());
                cprops.PF_vB = PropertyMethods.ViscWaltherASTM_B(cprops.PF_Tv1.GetValueOrDefault(), cprops.PF_v1.GetValueOrDefault(), cprops.PF_Tv2.GetValueOrDefault(), cprops.PF_v2.GetValueOrDefault());

                //Tc
                switch (type)
                {
                case SampleType.Light:
                    cprops.Critical_Temperature = PropertyMethods.Tc_RiaziDaubert(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                    break;

                case SampleType.Average:
                    cprops.Critical_Temperature = PropertyMethods.Tc_LeeKesler(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                    break;

                case SampleType.Heavy:
                    cprops.Critical_Temperature = PropertyMethods.Tc_Farah(cprops.PF_vA.GetValueOrDefault(), cprops.PF_vB.GetValueOrDefault(), cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                    break;
                }

                //Pc
                switch (type)
                {
                case SampleType.Light:
                    cprops.Critical_Pressure = PropertyMethods.Pc_RiaziDaubert(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                    break;

                case SampleType.Average:
                    cprops.Critical_Pressure = PropertyMethods.Pc_LeeKesler(cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                    break;

                case SampleType.Heavy:
                    cprops.Critical_Pressure = PropertyMethods.Pc_Farah(cprops.PF_vA.GetValueOrDefault(), cprops.PF_vB.GetValueOrDefault(), cprops.NBP.GetValueOrDefault(), cprops.PF_SG.GetValueOrDefault());
                    break;
                }

                //Af
                switch (type)
                {
                case SampleType.Heavy:
                    cprops.Acentric_Factor = PropertyMethods.AcentricFactor_LeeKesler(cprops.Critical_Temperature, cprops.Critical_Pressure, cprops.NBP.GetValueOrDefault());
                    break;

                case SampleType.Light:
                case SampleType.Average:
                    cprops.Acentric_Factor = PropertyMethods.AcentricFactor_Korsten(cprops.Critical_Temperature, cprops.Critical_Pressure, cprops.NBP.GetValueOrDefault());
                    break;
                }

                cprops.Normal_Boiling_Point = cprops.NBP.GetValueOrDefault();

                cprops.IsPF        = 1;
                cprops.PF_Watson_K = Math.Pow((1.8 * cprops.NBP.GetValueOrDefault()), (1 / 3)) / cprops.PF_SG.GetValueOrDefault();

                var tmp = (object[])methods2.calculate_Hf_Sf(cprops.PF_SG.GetValueOrDefault(), cprops.Molar_Weight, cprops.NBP.GetValueOrDefault());

                cprops.IG_Enthalpy_of_Formation_25C     = (double)tmp[0];
                cprops.IG_Entropy_of_Formation_25C      = (double)tmp[1];
                cprops.IG_Gibbs_Energy_of_Formation_25C = (double)tmp[0] - 298.15 * (double)tmp[1];

                DWSIM.Thermodynamics.Utilities.Hypos.Methods.HYP methods = new DWSIM.Thermodynamics.Utilities.Hypos.Methods.HYP();

                cprops.HVap_A = methods.DHvb_Vetere(cprops.Critical_Temperature, cprops.Critical_Pressure, cprops.Normal_Boiling_Point) / cprops.Molar_Weight;

                cprops.Critical_Compressibility = DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.Zc1(cprops.Acentric_Factor);
                cprops.Critical_Volume          = 8314 * cprops.Critical_Compressibility * cprops.Critical_Temperature / cprops.Critical_Pressure;
                cprops.Z_Rackett = DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.Zc1(cprops.Acentric_Factor);
                if (cprops.Z_Rackett < 0)
                {
                    cprops.Z_Rackett = 0.2;
                }

                cprops.Chao_Seader_Acentricity          = cprops.Acentric_Factor;
                cprops.Chao_Seader_Solubility_Parameter = Math.Pow(((cprops.HVap_A * cprops.Molar_Weight - 8.314 * cprops.Normal_Boiling_Point) * 238.846 * DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.liq_dens_rackett(cprops.Normal_Boiling_Point, cprops.Critical_Temperature, cprops.Critical_Pressure, cprops.Acentric_Factor, cprops.Molar_Weight) / cprops.Molar_Weight / 1000000.0), 0.5);
                cprops.Chao_Seader_Liquid_Molar_Volume  = 1 / DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.liq_dens_rackett(cprops.Normal_Boiling_Point, cprops.Critical_Temperature, cprops.Critical_Pressure, cprops.Acentric_Factor, cprops.Molar_Weight) * cprops.Molar_Weight / 1000 * 1000000.0;

                methods = null;

                cprops.ID = 30000 + i + 1;

                i += 1;
            }

            //Adjust Acentric Factors and Rackett parameters to fit NBP and Density

            DensityFitting  dfit     = new DensityFitting();
            PRVSFitting     prvsfit  = new PRVSFitting();
            SRKVSFitting    srkvsfit = new SRKVSFitting();
            NBPFitting      nbpfit   = new NBPFitting();
            MaterialStream  tms      = new MaterialStream("", "");
            PropertyPackage pp       = default(PropertyPackage);
            double          fzra     = 0;
            double          fw       = 0;
            double          fprvs    = 0;
            double          fsrkvs   = 0;

            if (flowsheet.PropertyPackages.Count > 0)
            {
                pp = (DWSIM.Thermodynamics.PropertyPackages.PropertyPackage)flowsheet.PropertyPackages.Values.First();
            }
            else
            {
                pp = new PengRobinsonPropertyPackage();
            }

            foreach (var c in ccol.Values)
            {
                tms.Phases[0].Compounds.Add(c.Name, c);
            }

            bool recalcVc = false;

            i = 0;
            foreach (var c in ccol.Values)
            {
                var _with4 = nbpfit;
                _with4._pp  = pp;
                _with4._ms  = tms;
                _with4._idx = i;
                try
                {
                    fw = _with4.MinimizeError();
                }
                catch (Exception ex)
                {
                    flowsheet.ShowMessage("Error fitting Acentric Factor for compound '" + c.Name + "': " + ex.Message, IFlowsheet.MessageType.GeneralError);
                }
                var _with5 = c.ConstantProperties;
                c.ConstantProperties.Acentric_Factor *= fw;
                c.ConstantProperties.Z_Rackett        = DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.Zc1(c.ConstantProperties.Acentric_Factor);
                if (_with5.Z_Rackett < 0)
                {
                    _with5.Z_Rackett = 0.2;
                    recalcVc         = true;
                }
                _with5.Critical_Compressibility = DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.Zc1(_with5.Acentric_Factor);
                _with5.Critical_Volume          = DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.Vc(_with5.Critical_Temperature, _with5.Critical_Pressure, _with5.Acentric_Factor, _with5.Critical_Compressibility);

                var _with6 = dfit;
                _with6._comp = c;
                try
                {
                    fzra = _with6.MinimizeError();
                }
                catch (Exception ex)
                {
                    flowsheet.ShowMessage("Error fitting Rackett Parameter for compound '" + c.Name + "': " + ex.Message, IFlowsheet.MessageType.GeneralError);
                }
                var _with7 = c.ConstantProperties;
                _with7.Z_Rackett *= fzra;
                if (_with7.Critical_Compressibility < 0 | recalcVc)
                {
                    _with7.Critical_Compressibility = _with7.Z_Rackett;
                    _with7.Critical_Volume          = DWSIM.Thermodynamics.PropertyPackages.Auxiliary.PROPS.Vc(_with7.Critical_Temperature, _with7.Critical_Pressure, _with7.Acentric_Factor, _with7.Critical_Compressibility);
                }

                c.ConstantProperties.PR_Volume_Translation_Coefficient = 1;
                prvsfit._comp = c;
                fprvs         = prvsfit.MinimizeError();
                var _with8 = c.ConstantProperties;
                if (Math.Abs(fprvs) < 99.0)
                {
                    _with8.PR_Volume_Translation_Coefficient *= fprvs;
                }
                else
                {
                    _with8.PR_Volume_Translation_Coefficient = 0.0;
                }
                c.ConstantProperties.SRK_Volume_Translation_Coefficient = 1;
                srkvsfit._comp = c;
                fsrkvs         = srkvsfit.MinimizeError();
                var _with9 = c.ConstantProperties;
                if (Math.Abs(fsrkvs) < 99.0)
                {
                    _with9.SRK_Volume_Translation_Coefficient *= fsrkvs;
                }
                else
                {
                    _with9.SRK_Volume_Translation_Coefficient = 0.0;
                }
                recalcVc = false;
                i       += 1;
            }

            pp     = null;
            dfit   = null;
            nbpfit = null;
            tms    = null;

            return(ccol);
        }
示例#5
0
 public PropertyDeclaration(string name, Type type, PropertyMethods methods)
 {
     Name    = name;
     Type    = type;
     Methods = methods;
 }
示例#6
0
 public InterfaceModelBuilder Property(string name, Type type, PropertyMethods methods = PropertyMethods.Both)
 {
     Properties[name] = new PropertyDeclaration(name, type, methods);
     return(this);
 }
示例#7
0
 public InterfaceModelBuilder Property <T>(string name, PropertyMethods methods = PropertyMethods.Both)
 {
     return(Property(name, typeof(T)));
 }
示例#8
0
 public FakeCommonTypeBuilder AddProperty(string name, FakeType propertyType, PropertyMethods propertyMethods, params FakeAttribute[] propertyFakeAttributes)
 {
     properties.Add(new FakeProperty(name, propertyType, propertyMethods, propertyFakeAttributes));
     return(this);
 }
示例#9
0
 public FakeCommonTypeBuilder AddProperty(string name, FakeType propertyType, PropertyMethods propertyMethods, params Attribute[] propertyAttributes)
 {
     return(AddProperty(name, propertyType, propertyMethods, propertyAttributes.Select(attribute => new FakeAttribute(attribute)).ToArray()));
 }
示例#10
0
 public FakeCommonTypeBuilder AddProperty(string name, Type propertyType, PropertyMethods propertyMethods, params FakeAttribute[] propertyFakeAttributes)
 {
     return(AddProperty(name, new FakeType(propertyType), propertyMethods, propertyFakeAttributes));
 }
示例#11
0
 public FakeProperty(string name, Type propertyType, PropertyMethods propertyMethods, FakeAttribute[] attributes = null) : this(name, new FakeType(propertyType), propertyMethods, attributes)
 {
 }