コード例 #1
0
ファイル: SPElement.cs プロジェクト: birdol/MCoil
        public static CalcResult ElementCalc(string[] fluid, double[] composition, double dh, double l, double Aa_fin, double Aa_tube, double A_r_cs, double Ar, double tai,
                                             double tri, double pri, double hri, double mr, double g, double ma, double ha,
                                             double eta_surface, double zh, double zdp, int hexType, double thickness, double conductivity, double Pwater)
        {
            double     r_metal = thickness / conductivity / Ar;
            double     gg      = 9.8;
            CalcResult res     = new CalcResult();

            Refrigerant.TPFLSHResult r = new Refrigerant.TPFLSHResult();
            r = Refrigerant.TPFLSH(fluid, composition, tri + 273.15, fluid[0] == "Water" ? Pwater : pri);
            double wm    = Refrigerant.WM(fluid, composition).Wm;
            double mu_r  = Refrigerant.TRNPRP(fluid, composition, tri + 273.15, r.D).Viscosity / Math.Pow(10, 6);
            double k_r   = Refrigerant.TRNPRP(fluid, composition, tri + 273.15, r.D).ThermalConductivity;
            double rho_r = r.D * wm;
            double cp_r  = r.cp / wm * 1000;
            double Pr_r  = cp_r * mu_r / k_r;

            res.Vel_r = g / rho_r;
            double Re_r    = rho_r * res.Vel_r * dh / mu_r;
            double fh      = RefrigerantSPHTC.ff_CHURCHILL(Re_r);
            double Nusselt = RefrigerantSPHTC.NU_GNIELINSKI(Re_r, Pr_r, fh);

            res.href = Nusselt * k_r / dh * zh;
            double cp_a = 1.0;

            cp_a = (hexType == 0 ? 1.027 : 1.02);

            double C_r = mr * cp_r / 1000;
            double C_a = ma * cp_a;

            res.R_1a = 1 / ((eta_surface * Aa_fin + Aa_tube) * ha);
            res.R_1r = 1 / (res.href * Ar);
            res.R_1  = res.R_1a + res.R_1r + r_metal;
            double UA      = 1 / res.R_1;
            double C_min   = Math.Min(C_a, C_r);
            double C_max   = Math.Max(C_a, C_r);
            double C_ratio = C_min / C_max;
            double NTU     = UA / (C_min * 1000);
            double epsilon = 1 - Math.Exp(Math.Pow(C_ratio, -1.0) * Math.Pow(NTU, 0.22)
                                          * (Math.Exp(-C_ratio * Math.Pow(NTU, 0.78)) - 1));

            res.Q = epsilon * C_min * Math.Abs(tri - tai);
            if (C_r < C_a)
            { // hexType=0 :evap, 1:cond
                res.Tro = tri + Math.Pow(-1, hexType) * epsilon * Math.Abs(tai - tri);
                res.Tao = tai + Math.Pow(-1, (hexType + 1)) * C_r * (Math.Abs(res.Tro - tri) / C_a);
            }
            else
            {
                res.Tao = tai + Math.Pow(-1, (hexType + 1)) * epsilon * Math.Abs(tai - tri);
                res.Tro = tri + Math.Pow(-1, hexType) * C_a * (Math.Abs(tai - res.Tao) / C_r);
            }
            double f_sp = RefrigerantSPDP.ff_Friction(Re_r);

            res.DP  = zdp * f_sp * l / dh * Math.Pow(g, 2.0) / rho_r / 2000;
            res.Pro = fluid[0] == "Water" ? pri : pri - res.DP;
            res.hro = hri + Math.Pow(-1, hexType) * res.Q / mr;

            return(res);
        }
コード例 #2
0
        public void TestMethod1()
        {
            string[] fluid       = new string[] { "R410A.MIX" };
            double[] composition = new double[] { 1 };
            double   temperature = 300;
            int      phase       = 2;

            var r1 = Refrigerant.SATT(fluid, composition, temperature, phase);
            var r2 = Refrigerant.CVCP(fluid, composition, temperature, r1.DensityV);

            Assert.AreEqual(1735.1590873766593, r1.Pressure, 0.1, "SATT");
        }
コード例 #3
0
        public static CalcResult SlabCalc(int[,] CirArrange, CircuitNumber CircuitInfo, int Nrow, int[] Ntube, int Nelement, string[] fluid, double[] composition, //double Npass, int[] N_tubes_pass,
                                          double dh, double l, GeometryResult[,] geo, double[, ,] ta,
                                          double te, double pe, double hri, double mr, double ma, double ha,
                                          double eta_surface, double zh, double zdp, int hexType, double thickness, double conductivity, double Pwater)

        {
            //------->
            // R2   R1

            // [11   1] <====
            // [12   2] <====
            //          <==== Air
            // [13   3] <====
            // [14   4] <====
            // [15   5]  <====
            // [16   6] <====
            // [17   7] <====
            // [18   8]  <====
            // [19   9] <====
            // [20  10] <====

            //  Ncir=1, 11in, 20->10 1out


            // [19 - 17 - 15 - 13   11   9   7   5   3   1] <====Air
            // [20 - 18 - 16 - 14   12   10  8   6   4   2] <====Air
            //  Ncir=1, 20in, 20->19 1out

            // CirArrange = new int[,] { { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 } };
            // Nrow=2
            // Ncir=2
            double wm    = Refrigerant.WM(fluid, composition).Wm;
            double tri   = te; //Refrigerant.SATP(fluid, composition, pri, 1).Temperature - 273.15;
            double pri   = pe;
            int    Nciri = CircuitInfo.number[0];
            int    Nciro = CircuitInfo.number[1];
            int    Ncir  = (Nciri == Nciro ? Nciri : Nciri + Nciro);

            int N_tube       = Ntube[0];
            int N_tube_total = 0;

            CirArr[] cirArr = new CirArr[Nrow * N_tube];
            cirArr = CirArrangement.ReadCirArr(CirArrange, CircuitInfo, Nrow, Ntube);
            CalcResult res_slab = new CalcResult();

            double[]        pri_cir      = new double[Ncir]; //[element, tube, row]
            double[]        hri_cir      = new double[Ncir];
            double[]        tri_cir      = new double[Ncir];
            double[]        mr_ciri      = new double[Nciri];
            List <double[]> mr_ciri_base = new List <double[]>();

            double[] mr_ciro         = new double[Nciro];
            int[]    Ngroupin        = new int[Nciro];
            int      index           = 0;
            int      restartDP_index = 0;
            int      N_tube2         = 0;

            int[]        index_cir = new int[Ncir];
            CalcResult[] r         = new CalcResult[Ncir];
            CalcResult[] r1        = new CalcResult[Ncir];
            CalcResult[] r2        = new CalcResult[Ncir]; //for NinMout only
            CalcResult[] res_cir2  = new CalcResult[Nciro + 1];

            int flag_ciro  = 0;
            int Ncir_forDP = 0;

            double[] mr_forDP = new double[Nciri];
            int      k;
            double   te_calc = 0;

            CheckDP  dPconverge  = new CheckDP();
            CheckPri priconverge = new CheckPri();

            for (int i = 0; i < Nrow; i++)
            {
                N_tube_total += Ntube[i];
            }
            for (int i = 0; i < Nciro; i++)
            {
                mr_ciro[i] = mr / Nciro;
            }

            bool index_outbig;

            if (CircuitInfo.UnequalCir == null || CircuitInfo.UnequalCir[0] > 0)
            {
                index_outbig = false;
            }
            else
            {
                index_outbig = true;
            }

            if (CircuitInfo.UnequalCir != null)
            {
                for (int j = 0; j < Nciro; j++)
                {
                    for (int i = 0; i < Ncir; i++)
                    {
                        if (CircuitInfo.UnequalCir[i] == Nciri + 1 + j)
                        {
                            Ngroupin[j]++;
                        }
                    }
                    //for (int i = 0; i < Nciri; i++) mr_ciri[i] = mr_ciro[j] / Ngroupin[j];
                }
            }

            int iterforDP  = 0;
            int iterforPri = 0;

            //Starting properties
            do
            {
                r        = new CalcResult[Ncir];
                r1       = new CalcResult[Ncir];
                res_cir2 = new CalcResult[Nciro + 1];

                flag_ciro = (index_outbig ? 1 : 0);
                tri       = Refrigerant.SATP(fluid, composition, pri, 1).Temperature - 273.15;
                for (int j = 0; j < (flag_ciro == 1 ? (index_outbig ? Nciri + 1 : 1) : Nciro + 1); j++)
                {
                    if (j >= Nciro)
                    {
                        j         = j - Nciro; //for Nciro
                        flag_ciro = (index_outbig ? 0 : 1);
                    }
                    if (j == 1 && index_outbig && index == 0)
                    {
                        j         = j - 1;
                        flag_ciro = 0;
                    }

                    index = 0;
                    do
                    {
                        k = 0;
                        if (!index_outbig)
                        {
                            for (int i = 0; i < (flag_ciro == 1 ? Nciro : (Nciri == Nciro ? Ncir : Ncir - Nciro)); i++)
                            {
                                if (flag_ciro == 1)
                                {
                                    pri_cir[i + Ncir - Nciro] = res_cir2[i].Pro;
                                    hri_cir[i + Ncir - Nciro] = res_cir2[i].hro;
                                    tri_cir[i + Ncir - Nciro] = res_cir2[i].Tro;
                                }
                                else
                                {
                                    pri_cir[i] = pri;
                                    hri_cir[i] = hri;
                                    tri_cir[i] = tri;
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < (flag_ciro == 1 ? Nciro : Ncir); i++)
                            {
                                if (flag_ciro == 1)
                                {
                                    pri_cir[i] = pri;
                                    hri_cir[i] = hri;
                                    tri_cir[i] = tri;
                                }
                                else
                                {
                                    if (CircuitInfo.UnequalCir[i] == Nciri + 1 + j)
                                    {
                                        pri_cir[i] = r2[j].Pro;
                                        hri_cir[i] = r2[j].hro;
                                        tri_cir[i] = r2[j].Tro;
                                    }
                                }
                            }
                        }

                        for (int i = 0; i < Ncir; i++)
                        {
                            if (flag_ciro == 1)
                            {
                                if (CircuitInfo.UnequalCir[i] <= 0)
                                {
                                    //for (int i = 0; i < Ncir; i++)
                                    r[i] = Circuit.CircuitCalc(i, cirArr, CircuitInfo, Nrow, Ntube, Nelement, fluid, composition, dh, l, geo, ta,
                                                               tri_cir[i], pri_cir[i], hri_cir[i], mr_ciro[k], ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity, Pwater);
                                    r1[k] = r[i].ShallowCopy();
                                    r2[k] = r[i].ShallowCopy();
                                    if (!index_outbig)
                                    {
                                        r1[k].DP += res_cir2[k].DP;
                                    }

                                    index_cir[k] = i;
                                    k++;
                                    Ncir_forDP = Nciro;
                                    mr_forDP   = (double[])mr_ciro.Clone(); // mr_forDP = mr_ciro
                                    if (k == Nciro)
                                    {
                                        break;
                                    }
                                }
                            }
                            else if (Nciri == Nciro || CircuitInfo.UnequalCir[i] == Nciri + 1 + j)
                            {
                                if (index == 0)
                                {
                                    if (Nciri == Nciro)
                                    {
                                        mr_ciro.CopyTo(mr_ciri, 0);
                                    }
                                    else
                                    {
                                        if (restartDP_index == 1 || !priconverge.flag)
                                        {
                                            mr_ciri[k] = mr_ciri_base[j][k] * mr_ciro[j] / (mr / Nciro);
                                        }
                                        else
                                        {
                                            mr_ciri[k] = mr_ciro[j] / Ngroupin[j];
                                        }
                                    }
                                }
                                //else mr_ciri_base.CopyTo(mr_ciri[k], 0);

                                //for (int i = 0; i < Ncir; i++)
                                r[i] = Circuit.CircuitCalc(i, cirArr, CircuitInfo, Nrow, Ntube, Nelement, fluid, composition, dh, l, geo, ta,
                                                           tri_cir[i], pri_cir[i], hri_cir[i], mr_ciri[k], ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity, Pwater);
                                r1[k]        = r[i].ShallowCopy();
                                index_cir[k] = i;
                                k++;

                                if (k == (Nciri == Nciro ? Ncir : Ngroupin[j]))
                                {
                                    Ncir_forDP = (Nciri == Nciro ? Ncir : Ngroupin[j]);
                                    mr_forDP   = (double[])mr_ciri.Clone();
                                    break;
                                }
                            }
                        }

                        if (index_outbig && flag_ciro == 1)
                        {
                            break;
                        }

                        index++;
                        //dPconverge = CheckDPforCircuits.CheckDPConverge(mr, mr_ciri, r, Ncir);
                        dPconverge = CheckDPforCircuits.CheckDPConverge(flag_ciro, mr_forDP, r1, Ncir_forDP);
                        if (flag_ciro == 0)
                        {
                            restartDP_index = 0;
                            if (!dPconverge.flag)
                            {
                                dPconverge.mr.CopyTo(mr_ciri, 0);                  //mr_ciri = dPconverge.mr;
                            }
                        }
                        else //(flag_ciro == 1)
                        {
                            if (dPconverge.flag)
                            {
                                restartDP_index = 0;
                            }
                            else
                            {
                                restartDP_index = 1;
                                dPconverge.mr.CopyTo(mr_ciro, 0); //mr_ciro = dPconverge.mr;
                                break;
                            }
                        }
                        iterforDP++;


                        N_tube2 = 0;
                        #region //Result print out
                        if (dPconverge.flag)
                        {
                            if (Nciri == Nciro)
                            {
                                te_calc = Refrigerant.SATP(fluid, composition, r[j].Pro, 1).Temperature;
                            }
                            else
                            {
                                if (mr_ciri_base.Count < Nciro)
                                {
                                    mr_ciri_base.Add(mr_forDP);                             //keep original mr ratio for fast iter
                                }
                                j           = (flag_ciro == 1 ? j + Nciro : j);
                                res_cir2[j] = new CalcResult();
                                for (int i = 0; i < (flag_ciro == 1 ? Nciro : Ngroupin[j]); i++)
                                {
                                    res_cir2[j].Q   += r1[i].Q;
                                    res_cir2[j].M   += r1[i].M;
                                    res_cir2[j].hro += (flag_ciro == 1 ? mr_ciro[i] : mr_ciri[i]) * r1[i].hro;
                                    if (fluid[0] == "Water")
                                    {
                                        res_cir2[j].Tro += (flag_ciro == 1 ? mr_ciro[i] : mr_ciri[i]) * r1[i].Tro;
                                    }

                                    res_cir2[j].Vel_r = r1[i].Vel_r;
                                    res_cir2[j].href += r1[i].href * CircuitInfo.TubeofCir[index_cir[i]];
                                    res_cir2[j].R_1  += r1[i].R_1 * CircuitInfo.TubeofCir[index_cir[i]];
                                    res_cir2[j].R_1a += r1[i].R_1a * CircuitInfo.TubeofCir[index_cir[i]];
                                    res_cir2[j].R_1r += r1[i].R_1r * CircuitInfo.TubeofCir[index_cir[i]];

                                    N_tube2 += CircuitInfo.TubeofCir[index_cir[i]];
                                }
                                res_cir2[j].DP         = r1[(flag_ciro == 1 ? Nciro : Ngroupin[j]) - 1].DP;
                                res_cir2[j].Tao_Detail = ta;
                                res_cir2[j].Pro        = r1[(flag_ciro == 1 ? Nciro : Ngroupin[j]) - 1].Pro;
                                res_cir2[j].hro        = res_cir2[j].hro / (flag_ciro == 1 ? mr : mr_ciro[j]);

                                res_cir2[j].href = res_cir2[j].href / N_tube2;
                                res_cir2[j].R_1  = res_cir2[j].R_1 / N_tube2;
                                res_cir2[j].R_1a = res_cir2[j].R_1a / N_tube2;
                                res_cir2[j].R_1r = res_cir2[j].R_1r / N_tube2;

                                te_calc = Refrigerant.SATP(fluid, composition, res_cir2[j].Pro, 1).Temperature;
                                if (fluid[0] == "Water")
                                {
                                    res_cir2[j].Tro = res_cir2[j].Tro / (flag_ciro == 1 ? mr : mr_ciro[j]);
                                }
                                else
                                {
                                    res_cir2[j].Tro = Refrigerant.PHFLSH(fluid, composition, res_cir2[j].Pro, (res_cir2[j].hro + 140) * wm).t - 273.15;
                                }
                            }
                        }
                        #endregion
                    } while (!dPconverge.flag && iterforDP < 100);

                    if (Nciri == Nciro)
                    {
                        break;
                    }

                    if (index_outbig && j == Nciro - 1)
                    {
                        for (int i = 0; i < Nciro; i++)
                        {
                            r2[i].DP += res_cir2[i].DP;
                        }
                        flag_ciro  = 1;
                        Ncir_forDP = Nciro;
                        mr_forDP   = (double[])mr_ciro.Clone(); // mr_forDP = mr_ciro
                        dPconverge = CheckDPforCircuits.CheckDPConverge(flag_ciro, mr_forDP, r2, Ncir_forDP);
                        if (!dPconverge.flag)
                        {
                            restartDP_index = 1;
                            dPconverge.mr.CopyTo(mr_ciro, 0); //mr_ciro = dPconverge.mr;
                        }
                        break;
                    }
                }

                using (StreamWriter wr = File.AppendText(@"D:\Work\Simulation\Test\MinNout.txt"))
                {
                    for (int i = 0; i < Ncir; i++)
                    {
                        wr.WriteLine("Q, {0}, DP, {1}, href, {2}, Ra_ratio, {3}, Tao, {4}, Tro, {5}, mr, {6}", r[i].Q, r[i].DP, r[i].href, r[i].Ra_ratio, r[i].Tao, r[i].Tro, r[i].mr);
                    }
                }


                if (restartDP_index == 1)
                {
                    priconverge.flag = false;
                }
                else if (hexType == 0 && (fluid[0] != "Water"))
                {
                    priconverge = CheckPin.CheckPriConverge(te, te_calc - 273.15, pri, pe, r[Ncir - 1].Pro); //res_slab.Pro
                    iterforPri++;
                    pri = priconverge.pri;
                    if (priconverge.flag && iterforPri == 1 && iterforDP == 1)
                    {
                        priconverge.flag = false;                                                        //to avoid not even iterate but converge by chance
                    }
                }
                else
                {
                    priconverge.flag = true;
                }
            } while (!priconverge.flag && iterforPri < 20);


            if (iterforDP >= 100)
            {
                throw new Exception("iter for DPConverge > 100.");
            }
            if (iterforPri >= 20)
            {
                throw new Exception("iter for DPPri > 20.");
            }

            #region //Result print out

            for (int i = 0; i < Ncir; i++)
            {
                res_slab.Q += r[i].Q;
                res_slab.M += r[i].M;
                if (Nciri == Nciro)
                {
                    res_slab.hro += mr_ciri[i] * r[i].hro;
                }
                res_slab.href += r[i].href * CircuitInfo.TubeofCir[i];
                res_slab.R_1  += r[i].R_1 * CircuitInfo.TubeofCir[i];
                res_slab.R_1a += r[i].R_1a * CircuitInfo.TubeofCir[i];
                res_slab.R_1r += r[i].R_1r * CircuitInfo.TubeofCir[i];
            }
            if (Nciri == Nciro)
            {
                res_slab.hro   = res_slab.hro / mr;
                res_slab.Pro   = r[Ncir - 1].Pro;
                res_slab.Vel_r = r[Ncir - 1].Vel_r;
            }
            else if (!index_outbig)
            {
                res_slab.hro   = res_cir2[Nciro].hro;
                res_slab.Pro   = res_cir2[Nciro].Pro;
                res_slab.Vel_r = res_cir2[Nciro].Vel_r;
            }
            else
            {
                res_slab.hro   = res_cir2[Nciro - 1].hro;
                res_slab.Pro   = res_cir2[Nciro - 1].Pro;
                res_slab.Vel_r = res_cir2[Nciro - 1].Vel_r;
            }
            res_slab.Pri        = pri;
            res_slab.Tri        = tri;
            res_slab.hri        = hri;
            res_slab.mr         = mr;
            res_slab.DP         = pri - res_slab.Pro;
            res_slab.Tao_Detail = ta;
            res_slab.href       = res_slab.href / N_tube_total;
            res_slab.ha         = ha;
            res_slab.R_1        = res_slab.R_1 / N_tube_total;
            res_slab.R_1a       = res_slab.R_1a / N_tube_total;
            res_slab.R_1r       = res_slab.R_1r / N_tube_total;

            te_calc = Refrigerant.SATP(fluid, composition, res_slab.Pro, 1).Temperature;
            double densityLo = Refrigerant.SATT(fluid, composition, te_calc, 1).DensityL;  //mol/L
            double densityVo = Refrigerant.SATT(fluid, composition, te_calc, 2).DensityV;  //mol/L
            //double wm = Refrigerant.WM(fluid, composition).Wm;
            double hlo = Refrigerant.ENTHAL(fluid, composition, te_calc, densityLo).Enthalpy / wm - (fluid[0] == "Water" ? 0 : 140);
            double hvo = Refrigerant.ENTHAL(fluid, composition, te_calc, densityVo).Enthalpy / wm - (fluid[0] == "Water" ? 0 : 140);
            res_slab.x_o = (res_slab.hro - hlo) / (hvo - hlo);
            double densityLi = Refrigerant.SATT(fluid, composition, tri + 273.15, 1).DensityL;  //mol/L
            double densityVi = Refrigerant.SATT(fluid, composition, tri + 273.15, 2).DensityV;  //mol/L
            //double wm = Refrigerant.WM(fluid, composition).Wm;
            double hli = Refrigerant.ENTHAL(fluid, composition, tri + 273.15, densityLi).Enthalpy / wm - (fluid[0] == "Water" ? 0 : 140);
            double hvi = Refrigerant.ENTHAL(fluid, composition, tri + 273.15, densityVi).Enthalpy / wm - (fluid[0] == "Water" ? 0 : 140);
            res_slab.x_i = (res_slab.hri - hli) / (hvi - hli);
            res_slab.Tro = Refrigerant.PHFLSH(fluid, composition, res_slab.Pro, (res_slab.hro + (fluid[0] == "Water" ? 0 : 140)) * wm).t - 273.15;

            for (int j = 0; j < N_tube; j++)
            {
                for (int i = 0; i < Nelement; i++)
                {
                    res_slab.Tao += res_slab.Tao_Detail[i, j, Nrow];
                }
            }
            res_slab.Tao      = res_slab.Tao / N_tube;
            res_slab.Ra_ratio = res_slab.R_1a / res_slab.R_1;
            res_slab.ma       = ma;
            res_slab.Va       = ma / 1.2 * 3600;
            return(res_slab);

            #endregion
        }
コード例 #4
0
        public static CalcResult ElementCal(string[] fluid, double[] composition, double dh, double l,
                                            double Aa_fin, double Aa_tube, double A_r_cs, double Ar, double tai,
                                            double tri, double pri, double hri, double mr, double g, double ma, double ha,
                                            double eta_surface, double zh, double zdp, int hexType, double thickness, double conductivity, double Pwater)
        {
            var    r    = new Refrigerant.SATTTotalResult();
            double href = 0;
            double gg   = 9.8;
            double tsat;
            int    phase1 = 1;
            int    phase2 = 2;

            tsat = Refrigerant.SATP(fluid, composition, pri, phase1).Temperature;
            r    = Refrigerant.SATTTotal(fluid, composition, tsat).SATTTotalResult;

            double Vol_tubes = A_r_cs * l;   //Tube volume, for charge calculation
            double h_l       = r.EnthalpyL;
            double h_v       = r.EnthalpyV;
            double Tri_mod;
            double alpha;
            double M;
            var    res_element = new CalcResult();

            // **********Superheated state**********
            if (hri > h_v && fluid[0] != "Water")
            {
                if (hri < 1.02 * h_v)
                {
                    Tri_mod = tri + 0.5;   //"for Tri modification in the transition region"
                }
                else
                {
                    Tri_mod = tri;
                }

                res_element     = SPElement.ElementCalc(fluid, composition, dh, l, Aa_fin, Aa_tube, A_r_cs, Ar, tai, Tri_mod, pri, hri, mr, g, ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity, Pwater);
                res_element.x_i = (hri - h_l) / (h_v - h_l);
                res_element.x_o = (res_element.hro - h_l) / (h_v - h_l);
                alpha           = 1;                                                                  //set void fraction to 1 to identify a superheated state
                //{Equations are for charge calculation}
                double T_avg = (tri + res_element.Tro) / 2;                                           //Average temperature of the element
                double P_avg = (pri + res_element.Pro) / 2;                                           //Average pressure of the element
                double rho   = Refrigerant.TPFLSH(fluid, composition, T_avg + 273.15, P_avg).D *r.Wm; //density(ref$, T=T_avg, P=P_avg)
                M = Vol_tubes * rho;                                                                  //"Mass calculated"
            }

            // **********Twophase state**********"
            if (hri <= h_v && hri >= h_l && fluid[0] != "Water")
            {
                res_element = TPElement.ElementCalc(fluid, composition, dh, l, Aa_fin, Aa_tube, A_r_cs, Ar, tai, tri, pri, hri, mr, g, ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity);
                //x=x_o  "outlet quality of the element"
                double x_avg = (res_element.x_i + res_element.x_o) / 2; //Average quality of the element
                if (x_avg < 0)                                          //"If negative, set quality to inlet value"
                {
                    x_avg = res_element.x_i;
                }

                double T_avg = (tri + res_element.Tro) / 2;  //Average temperature of the element
                //Call VOIDFRACTION_charge(ref$,x_avg, T_avg, G_r, Dh: alpha) "Average void fraction of the element"
                alpha = 1;
                //{Equations are for charge calculation}
                double P_avg = (pri + res_element.Pro) / 2; //Average pressure of the element
                double rho_l = Refrigerant.SATP(fluid, composition, P_avg, phase1).DensityL *r.Wm;
                double rho_v = Refrigerant.SATP(fluid, composition, P_avg, phase1).DensityV *r.Wm;
                //{Call VOIDFRACTION_pressure(ref$, x_avg, P_avg : alpha_p)  "Baroczy void fraction model"     }
                M = Vol_tubes * (alpha * rho_v + (1 - alpha) * rho_l);  //Mass calculated
            }

            //**********Subcooled state**********
            if (hri < h_l || fluid[0] == "Water")
            {
                if (hri > 0.98 * h_l)
                {
                    Tri_mod = tri - 0.5;    //"for Tri modification in the transition region"
                }
                else
                {
                    Tri_mod = tri;
                }

                if (fluid[0] == "Water")
                {
                    Tri_mod = tri - 0.0001;
                }

                res_element = SPElement.ElementCalc(fluid, composition, dh, l, Aa_fin, Aa_tube, A_r_cs, Ar, tai, Tri_mod, pri, hri, mr, g, ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity, Pwater);
                //Call SUBCOOLED(ref$, Dh, L, A_a, A_r, Tai, Tri_mod, Pri, hri, m_r, G_r, m_a, h_air, eta_surface: Tro, Pro, hro, Tao, Q, h_ref, R_1, R_1a, R_1r, DELTAP, Vel_r )
                res_element.x_i = (hri - h_l) / (h_v - h_l);
                res_element.x_o = (res_element.hro - h_l) / (h_v - h_l);
                //x=x_o  "outlet quality of the element"
                //{x=-1 "set quality to -100 to identify a subcooled state"}
                alpha = -1;                                                                  //set void fraction to -100 to identify a subcooled state
                //{Equations are for charge calculation}
                double T_avg = (tri + res_element.Tro) / 2;                                  //Average temperature of the element
                double P_avg = (pri + res_element.Pro) / 2;                                  //Average pressure of the element
                double rho   = Refrigerant.TPFLSH(fluid, composition, T_avg, P_avg).D *r.Wm; //density(ref$, T=T_avg, P=P_avg)
                M = Vol_tubes * rho;                                                         //Mass calculated
            }


            return(res_element);
        }
コード例 #5
0
ファイル: TPElement.cs プロジェクト: birdol/MCoil
        public static CalcResult ElementCalc(string[] fluid, double[] composition, double dh, double l, double Aa_fin, double Aa_tube, double A_r_cs, double Ar, double tai,
                                             double tri, double pri, double hri, double mr, double g, double ma, double ha,
                                             double eta_surface, double zh, double zdp, int hexType, double thickness, double conductivity)
        {
            double r_metal = thickness / conductivity / Ar;
            double gg      = 9.8;
            //double temperature;
            int    phase1    = 1;
            int    phase2    = 2;
            double q_initial = 0.01;
            double q         = q_initial;
            double err       = 0.01;
            bool   flag      = false;
            int    iter      = 1;

            CalcResult res = new CalcResult();
            //res.Tao[0] = new double();
            var r = new Refrigerant.SATTTotalResult();

            //temperature = Refrigerant.SATP(fluid, composition, pri, phase1).Temperature;
            r       = Refrigerant.SATTTotal(fluid, composition, tri + 273.15).SATTTotalResult; //temperature
            res.x_i = (hri - r.EnthalpyL) / (r.EnthalpyV - r.EnthalpyL);                       //+ 140 for reference state, to be changed

            RefHTCandDPResult htc_dp = new RefHTCandDPResult();

            do
            {
                flag   = false;
                htc_dp = RefrigerantHTCandDP.HTCandDP(fluid, composition, dh, g, pri, res.x_i, l, q, zh, zdp);

                res.href = htc_dp.Href;
                res.DP   = htc_dp.DPref;
                double cp_a = 1.0; //keep it for now as a constant
                cp_a = (hexType == 0 ? 1.027 : 1.02);
                double C_a = ma * cp_a;
                res.R_1a = 1 / ((eta_surface * Aa_fin + Aa_tube) * ha);
                res.R_1r = 1 / (res.href * Ar);
                res.R_1  = res.R_1a + res.R_1r + r_metal;
                double UA      = 1 / res.R_1;
                double NTU     = UA / (C_a * 1000);
                double epsilon = 1 - Math.Exp(-NTU);
                res.Q   = epsilon * C_a * Math.Abs(tai - tri);
                res.Tao = tai + Math.Pow(-1, (hexType + 1)) * res.Q / C_a;
                res.hro = hri + Math.Pow(-1, hexType) * res.Q / mr;
                //0:evap, 1:cond

                res.x_o = (res.hro - r.EnthalpyL) / (r.EnthalpyV - r.EnthalpyL); //+ 139.17 for reference state, to be changed
                //res.DP = 0;
                res.Pro = pri - res.DP;
                res.Tro = Refrigerant.PHFLSH(fluid, composition, res.Pro, (res.hro + (fluid[0] == "Water" ? 0 : 140)) * r.Wm).t; //
                double rho_o = Refrigerant.TQFLSH(fluid, composition, res.Tro, res.x_o).D *r.Wm;
                //    .TPFLSH(fluid, composition, res.Tro, res.Pro).D * r.Wm;//wrong value
                //double rho_o = Refrigerant.PHFLSH(fluid, composition, res.Pro, (res.hro + 140) * r.Wm).D * r.Wm;
                //if (res.x_o > 1 || res.x_o < 0)
                //    rho_o = Refrigerant.PHFLSH(fluid, composition, res.Pro, res.hro).D;
                ////rho_o=density(ref$, P=Pri, T=Tro)
                //else
                //    rho_o = 0;
                //    //rho_o=density(ref$, P=Pri, x=x_o)
                res.Tro   = res.Tro - 273.15;
                res.Vel_r = g / rho_o;
                if (Math.Abs(q - res.Q) / res.Q > err)
                {
                    q    = res.Q;
                    flag = true;
                }
                iter++;
            } while (flag && iter < 100);

            if (iter >= 100)
            {
                throw new Exception("iter for href > 100.");
            }
            return(res);
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: birdol/MCoil
        public static CalcResult NinMout()
        {
            //string[] fluid = new string[] { "Water" };
            string[] fluid = new string[] { "R410A.MIX" };
            //string[] fluid = new string[] { "ISOBUTAN" };
            double[]   composition = new double[] { 1 };
            CalcResult res         = new CalcResult();
            int        Nrow        = 2;

            double[] FPI = new double[Nrow + 1];
            //FPI = new double[] { 1.27, 1.27, 1.27, 1.27, 1.27, 1.27, 1.27, 2.6, 2.6, 2.6, 2.6, 2.6, 2.6, 2.6, 2.6, 5.2, 5.2, 5.2, 5.2, 5.2, 5.2 };
            FPI = new double[] { 15, 15 };
            double Pt         = 1 * 25.4 * 0.001;
            double Pr         = 0.75 * 25.4 * 0.001;
            double Di         = 8.4074 * 0.001;  //8 6.8944
            double Do         = 10.0584 * 0.001; //8.4 7.35
            double Fthickness = 0.095 * 0.001;
            double thickness  = 0.5 * (Do - Di);

            //double n_tubes = 10;
            //double n_rows = 2;
            //int[] Ntube = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
            //int[] Ntube = { 2, 2, 2, 2 };
            int[]  Ntube    = { 24, 24 };
            int    N_tube   = Ntube[0];
            double L        = 914.4 * 0.001;
            int    Nelement = 1;

            int[,] CirArrange;

            //CirArrange = new int[,] { { 25, 26, 27, 28, 4, 3, 2, 1, 0, 0 }, { 29, 30, 31, 7, 6, 5, 0, 0, 0, 0 }, { 32, 33, 34, 35, 11, 10, 9, 8, 0, 0 },
            //{ 36, 37, 38, 39, 40, 16, 15, 14, 13, 12 }, { 41, 42, 43, 19, 18, 17, 0, 0, 0, 0 }, { 44, 45, 46, 47, 48, 24, 23, 22, 21, 20 } };
            //CircuitNumber CircuitInfo = new CircuitNumber();
            //CircuitInfo.number = new int[] { 4, 2 }; //4in 2out
            //CircuitInfo.TubeofCir = new int[] { 8, 6, 8, 10, 6, 10 };  //{ 4, 8 };
            //CircuitInfo.UnequalCir = new int[] { 5, 5, 6, 6, 0, 0 };
            //// [19 - 17 - 15 - 13   11   9   7   5   3   1] <====Air
            //// [20 - 18 - 16 - 14   12   10  8   6   4   2] <====Air

            //5in2out, test3
            //CirArrange = new int[,] { { 25, 26, 27, 28, 4, 3, 2, 1, 0, 0 }, { 29, 30, 31, 7, 6, 5, 0, 0, 0, 0 }, { 43, 42, 41, 17, 18, 19, 0, 0, 0, 0 },
            //{40, 39, 15, 16, 0, 0, 0, 0, 0, 0 }, { 44, 45, 46, 47, 48, 24, 23, 22, 21, 20 }, { 36, 37, 38, 14, 13, 12, 0, 0, 0, 0 },
            //{32, 33, 34, 35, 11, 10, 9, 8, 0, 0 }};
            //CirArrange = new int[,] { { 41, 42, 43, 19, 18, 17, 0, 0, 0, 0 }, { 44, 45, 46, 47, 48, 24, 23, 22, 21, 20 }, { 25, 26, 27, 28, 4, 3, 2, 1, 0, 0 },
            //{29, 30, 31, 7, 6, 5, 0, 0, 0, 0 }, { 32, 33, 34, 35, 11, 10, 9, 8, 0, 0 }, { 36, 37, 38, 39, 40, 16, 15, 14, 13, 12 }
            //};
            //Paralle flow
            CirArrange = new int[, ] {
                { 17, 18, 19, 43, 42, 41, 0, 0, 0, 0 }, { 20, 21, 22, 23, 24, 48, 47, 46, 45, 44 }, { 1, 2, 3, 4, 28, 27, 26, 25, 0, 0 },
                { 5, 6, 7, 31, 30, 29, 0, 0, 0, 0 }, { 8, 9, 10, 11, 35, 34, 33, 32, 0, 0 }, { 12, 13, 14, 15, 16, 40, 39, 38, 37, 36 }
            };
            CircuitNumber CircuitInfo = new CircuitNumber();

            CircuitInfo.number     = new int[] { 4, 2 };               //4in 2out
            CircuitInfo.TubeofCir  = new int[] { 6, 10, 8, 6, 8, 10 }; //{ 4, 8 };
            CircuitInfo.UnequalCir = new int[] { -5, -6, 5, 5, 6, 6 }; //{ 3, 4, -3, -3, -4, -4 };

            double mr       = 0.076;
            double Vel_a    = 1.8; //m/s
            double H        = Pt * N_tube;
            double Hx       = L * H;
            double rho_a_st = 1.2; //kg/m3

            double Va           = Vel_a * Hx;
            double ma           = Va * rho_a_st;                        //Va / 3600 * 1.2; //kg/s
            int    curve        = 1;                                    //
            double za           = 1;                                    //Adjust factor
            double ha           = AirHTC.alpha(Vel_a, za, curve) * 1.5; //71.84;//36.44;
            double eta_surface  = 1;
            double zh           = 1;
            double zdp          = 1;
            double tai          = 26.67;
            double tri          = 7.2;
            double te           = tri;
            double pe           = Refrigerant.SATT(fluid, composition, te + 273.15, 1).Pressure;
            double P_exv        = 1842.28; //kpa
            double T_exv        = 24;      //C
            double conductivity = 386;     //w/mK for Cu
            double Pwater       = 0;
            int    hexType      = 0;       //*********************************0 is evap, 1 is cond******************************************
            //double densityL = Refrigerant.SATT(fluid, composition, te + 273.15, 1).DensityV;
            //double hri = Refrigerant.ENTHAL(fluid, composition, tri + 273.15, densityL).Enthalpy ;
            double wm = Refrigerant.WM(fluid, composition).Wm; //g/mol
            //hri = hri / wm - 140;
            double hri = Refrigerant.TPFLSH(fluid, composition, T_exv + 273.15, P_exv).h / wm - (fluid[0] == "Water" ? 0 : 140);

            //double hri = 354.6;
            //double xin = 0.57;

            double[, ,] ta = new double[Nelement, N_tube, Nrow + 1];

            //string AirDirection="DowntoUp";
            string AirDirection = "Counter";

            ta = InitialAirProperty.AirTemp(Nelement, Ntube, Nrow, tai, te, AirDirection);

            GeometryResult geo = new GeometryResult();

            //GeometryResult[,] geo_element = new GeometryResult[,] { };
            GeometryResult[,] geo_element = new GeometryResult[N_tube, Nrow];
            for (int k = 0; k < Nrow; k++)
            {
                for (int j = 0; j < N_tube; j++)
                {
                    geo_element[j, k] = Areas.Geometry(L / Nelement, FPI[k], Do, Di, Pt, Pr, Fthickness);
                    //geo_element[i] = Areas.Geometry(L / element, FPI[i], Do, Di, Pt, Pr);
                    geo.Aa_tube += geo_element[j, k].Aa_tube;
                    geo.Aa_fin  += geo_element[j, k].Aa_fin;
                    geo.A_a     += geo_element[j, k].A_a;
                    geo.A_r     += geo_element[j, k].A_r;
                    geo.A_r_cs  += geo_element[j, k].A_r_cs;
                    //geo.A_ratio += geo_element[j,k].A_ratio;
                }
            }
            geo.A_ratio = geo.A_r / geo.A_a;

            res = Slab.SlabCalc(CirArrange, CircuitInfo, Nrow, Ntube, Nelement, fluid, composition, Di, L, geo_element, ta, te, pe, hri,
                                mr, ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity, Pwater);

            //res = Slab.SlabCalc(Npass, N_tubes_pass, fluid, composition, Dh, L, geo.A_a, geo.A_r_cs, geo.A_r, tai, tri, pe, hri,
            //    mr, ma, ha, eta_surface, zh, zdp);
            //Tsh_calc = res.Tro - (Refrigerant.SATP(fluid, composition, res.Pro, 1).Temperature - 273.15);

            // res = Slab.SlabCalc(Npass, N_tubes_pass, fluid, composition, Dh, L, geo.A_a, geo.A_r_cs, geo.A_r, tai, tri, pe, hri,
            //     mr, ma, ha, eta_surface, zh, zdp);
            // Tsh_calc = res.Tro - (Refrigerant.SATP(fluid, composition, res.Pro, 1).Temperature - 273.15);

            return(res);
        }
コード例 #7
0
ファイル: Main.cs プロジェクト: birdol/MCoil
        public static CalcResult Water_Heat_Midea9()
        {
            string[] fluid = new string[] { "Water" };

            double[]   composition = new double[] { 1 };
            CalcResult res         = new CalcResult();
            int        Nrow        = 1;

            double[] FPI = new double[Nrow + 1];
            FPI = new double[] { 21 };
            double Pt         = 21 * 0.001;
            double Pr         = 18.19 * 0.001;
            double Di         = 6.8944 * 0.001; //8
            double Do         = 7.35 * 0.001;   //8.4
            double Fthickness = 0.095 * 0.001;
            double thickness  = 0.5 * (Do - Di);

            int[]  Ntube    = { 12 };
            int    N_tube   = Ntube[0];
            double L        = 410 * 0.001;
            int    Nelement = 1;

            int[,] CirArrange;
            CirArrange = new int[, ] {
                { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 }
            };
            CircuitNumber CircuitInfo = new CircuitNumber();

            CircuitInfo.number    = new int[] { 3, 3 };
            CircuitInfo.TubeofCir = new int[] { 4, 4, 4 };  //{ 4, 8 };

            int N = 28;

            for (int i = 0; i < N; i++)
            {
                double[] mr = new double[] { 10.01, 14.01, 18.0, 21.0, 25.0, 29.01, 31.0, 9.99, 14.01, 18.01, 21.01, 25.0, 29.01, 31.0, 10.01, 14.01, 18.01, 21.01, 25.0, 29.01, 31.01, 9.99, 14.0, 18.0, 21.0, 24.99, 29.0, 31.01 }; // 60;
                mr[i] = mr[i] / 60;
                double[] Vel_a    = new double[] { 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0 };                                      //m/s
                double   H        = Pt * N_tube;
                double   Hx       = L * H;
                double   rho_a_st = 1.188; //kg/m3

                double[] Va = new double[N];
                Va[i] = Vel_a[i] * Hx;
                double[] ma = new double[N];
                ma[i] = Va[i] * rho_a_st; //Va / 3600 * 1.2; //kg/s
                int      curve       = 1; //
                double   za          = 1; //Adjust factor
                double   zh          = 1;
                double   zdp         = 1;
                double[] eta_surface = new double[] { 0.8764, 0.8764, 0.8764, 0.8764, 0.8764, 0.8764, 0.8764, 0.865, 0.865, 0.865, 0.865, 0.865, 0.865, 0.865, 0.855, 0.855, 0.855, 0.855, 0.855, 0.855, 0.855, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846, 0.846 };
                //double ha = AirHTC.alpha(Vel_a, za, curve) / 79 * 78.7;//71.84;//36.44;
                //double[] ha = new double[] { 58.92, 58.92, 58.92, 58.92, 58.92, 58.92, 58.92, 65.61, 65.61, 65.61, 65.61, 65.61, 65.61, 65.61, 71.19, 71.19, 71.19, 71.19, 71.19, 71.19, 71.19, 75.95, 75.95, 75.95, 75.95, 75.95, 75.95, 75.95 };
                double[] ha  = new double[] { 58.51, 58.51, 58.51, 58.51, 58.51, 58.51, 58.51, 64.92, 64.92, 64.92, 64.92, 64.92, 64.92, 64.92, 70.41, 70.41, 70.41, 70.41, 70.41, 70.41, 70.41, 75.42, 75.42, 75.42, 75.42, 75.42, 75.42, 75.42 };
                double[] tai = new double[] { 20.01, 20.0, 20.02, 20.0, 19.99, 20.02, 20.0, 19.98, 20.0, 19.99, 19.99, 19.99, 19.98, 20.0, 19.98, 20.01, 19.99, 20.0, 20.0, 19.99, 19.99, 19.98, 20.01, 20.0, 20.0, 20.01, 20.01, 20.02 };
                double[] tri = new double[] { 45.01, 45.01, 44.99, 44.99, 45.0, 45.0, 44.99, 44.99, 45.01, 44.99, 45.01, 44.99, 45.01, 45.01, 45.0, 45.01, 44.99, 45.01, 45.01, 44.99, 45.01, 44.98, 45.01, 44.99, 45.0, 45.0, 45.01, 45.0 };
                double[] tc  = tri;
                double[] pc  = new double[N];
                pc[i] = Refrigerant.SATT(fluid, composition, tc[i] + 273.15, 1).Pressure;
                double   Pwater       = 395;                                   //kpa
                double   conductivity = 386;                                   //w/mK for Cu
                int      hexType      = 1;                                     //*********************************0 is evap, 1 is cond******************************************
                double   wm           = Refrigerant.WM(fluid, composition).Wm; //g/mol
                double[] hri          = new double[N];
                hri[i] = Refrigerant.TPFLSH(fluid, composition, tc[i] + 273.15, Pwater).h / wm - 0.5 - (fluid[0] == "Water" ? 0 : 140);

                double[, ,] ta = new double[Nelement, N_tube, Nrow + 1];
                string AirDirection = "Counter";
                ta = InitialAirProperty.AirTemp(Nelement, Ntube, Nrow, tai[i], tc[i], AirDirection);

                GeometryResult geo = new GeometryResult();
                GeometryResult[,] geo_element = new GeometryResult[N_tube, Nrow];
                for (int k = 0; k < Nrow; k++)
                {
                    for (int j = 0; j < N_tube; j++)
                    {
                        geo_element[j, k] = Areas.Geometry(L / Nelement, FPI[k], Do, Di, Pt, Pr, Fthickness);
                        //geo_element[i] = Areas.Geometry(L / element, FPI[i], Do, Di, Pt, Pr);
                        geo.Aa_tube += geo_element[j, k].Aa_tube;
                        geo.Aa_fin  += geo_element[j, k].Aa_fin;
                        geo.A_a     += geo_element[j, k].A_a;
                        geo.A_r     += geo_element[j, k].A_r;
                        geo.A_r_cs  += geo_element[j, k].A_r_cs;
                        //geo.A_ratio += geo_element[j,k].A_ratio;
                    }
                }

                geo.A_ratio = geo.A_r / geo.A_a;

                res = Slab.SlabCalc(CirArrange, CircuitInfo, Nrow, Ntube, Nelement, fluid, composition, Di, L, geo_element, ta, tc[i], pc[i], hri[i],
                                    mr[i], ma[i], ha[i], eta_surface[i], zh, zdp, hexType, thickness, conductivity, Pwater);
                //using (StreamWriter wr = File.AppendText(@"D:\Work\Simulation\Test\Midea9_heat.txt"))
                //{
                //    wr.WriteLine("Q, {0}, DP, {1}, href, {2}, Ra_ratio, {3}, Tao, {4}, Tro, {5}", res.Q, res.DP, res.href, res.Ra_ratio, res.Tao, res.Tro);
                //}
            }
            return(res);
        }
コード例 #8
0
ファイル: Main.cs プロジェクト: birdol/MCoil
        public static CalcResult Water_Midea9()
        {
            string[] fluid = new string[] { "Water" };

            double[]   composition = new double[] { 1 };
            CalcResult res         = new CalcResult();
            int        Nrow        = 1;

            double[] FPI = new double[Nrow + 1];
            FPI = new double[] { 21 };
            double Pt         = 21 * 0.001;
            double Pr         = 18.19 * 0.001;
            double Di         = 6.8944 * 0.001; //8
            double Do         = 7.35 * 0.001;   //8.4
            double Fthickness = 0.095 * 0.001;
            double thickness  = 0.5 * (Do - Di);

            int[]  Ntube    = { 12 };
            int    N_tube   = Ntube[0];
            double L        = 410 * 0.001;
            int    Nelement = 1;

            int[,] CirArrange;
            CirArrange = new int[, ] {
                { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 }
            };
            //CirArrange = new int[,] { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } };
            CircuitNumber CircuitInfo = new CircuitNumber();

            CircuitInfo.number    = new int[] { 3, 3 };
            CircuitInfo.TubeofCir = new int[] { 4, 4, 4 };  //{ 4, 8 };
            // [19 - 17 - 15 - 13   11   9   7   5   3   1] <====Air
            // [20 - 18 - 16 - 14   12   10  8   6   4   2] <====Air

            double mr       = 9.99 / 60;
            double Vel_a    = 2; //m/s
            double H        = Pt * N_tube;
            double Hx       = L * H;
            double rho_a_st = 1.188; //kg/m3

            double Va           = Vel_a * Hx;
            double ma           = Va * rho_a_st; //Va / 3600 * 1.2; //kg/s
            int    curve        = 1;             //
            double za           = 1;             //Adjust factor
            double zh           = 1;
            double zdp          = 1;
            double eta_surface  = 0.8284;
            double ha           = AirHTC.alpha(Vel_a, za, curve) / 79 * 77.42;//71.84;//36.44;
            double tai          = 19.98;
            double tri          = 44.98;
            double tc           = tri;
            double pc           = Refrigerant.SATT(fluid, composition, tc + 273.15, 1).Pressure;
            double Pwater       = 395;                                   //kpa
            double conductivity = 386;                                   //w/mK for Cu
            int    hexType      = 1;                                     //*********************************0 is evap, 1 is cond******************************************
            double wm           = Refrigerant.WM(fluid, composition).Wm; //g/mol
            double hri          = Refrigerant.TPFLSH(fluid, composition, tc + 273.15, Pwater).h / wm - 0.5 - (fluid[0] == "Water" ? 0 : 140);

            double[, ,] ta = new double[Nelement, N_tube, Nrow + 1];

            //string AirDirection="DowntoUp";
            string AirDirection = "Counter";

            ta = InitialAirProperty.AirTemp(Nelement, Ntube, Nrow, tai, tc, AirDirection);

            GeometryResult geo = new GeometryResult();

            //GeometryResult[,] geo_element = new GeometryResult[,] { };
            GeometryResult[,] geo_element = new GeometryResult[N_tube, Nrow];
            for (int k = 0; k < Nrow; k++)
            {
                for (int j = 0; j < N_tube; j++)
                {
                    geo_element[j, k] = Areas.Geometry(L / Nelement, FPI[k], Do, Di, Pt, Pr, Fthickness);
                    geo.Aa_tube      += geo_element[j, k].Aa_tube;
                    geo.Aa_fin       += geo_element[j, k].Aa_fin;
                    geo.A_a          += geo_element[j, k].A_a;
                    geo.A_r          += geo_element[j, k].A_r;
                    geo.A_r_cs       += geo_element[j, k].A_r_cs;
                    //geo.A_ratio += geo_element[j,k].A_ratio;
                }
            }
            geo.A_ratio = geo.A_r / geo.A_a;

            res = Slab.SlabCalc(CirArrange, CircuitInfo, Nrow, Ntube, Nelement, fluid, composition, Di, L, geo_element, ta, tc, pc, hri,
                                mr, ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity, Pwater);

            return(res);
        }
コード例 #9
0
ファイル: Main.cs プロジェクト: birdol/MCoil
        public static CalcResult Water_Midea5()
        {
            string[] fluid = new string[] { "Water" };
            //string[] fluid = new string[] { "R410A.MIX" };
            //string[] fluid = new string[] { "ISOBUTAN" };
            double[]   composition = new double[] { 1 };
            CalcResult res         = new CalcResult();
            int        Nrow        = 3;

            double[] FPI = new double[Nrow + 1];
            //FPI = new double[] { 1.27, 1.27, 1.27, 1.27, 1.27, 1.27, 1.27, 2.6, 2.6, 2.6, 2.6, 2.6, 2.6, 2.6, 2.6, 5.2, 5.2, 5.2, 5.2, 5.2, 5.2 };
            FPI = new double[] { 17, 17, 17 };
            double Pt         = 21 * 0.001;
            double Pr         = 13.37 * 0.001;
            double Di         = 6.8944 * 0.001; //8
            double Do         = 7.35 * 0.001;   //8.4
            double Fthickness = 0.095 * 0.001;
            double thickness  = 0.5 * (Do - Di);

            //double n_tubes = 10;
            //double n_rows = 2;
            //int[] Ntube = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
            //int[] Ntube = { 2, 2, 2, 2 };
            int[]  Ntube    = { 14, 14, 14 };
            int    N_tube   = Ntube[0];
            double L        = 367 * 0.001;
            int    Nelement = 1;

            int[,] CirArrange;
            //CirArrange = new int[,] { { 8, 6, 4, 2, 1, 3, 5, 7 } };//actual, counter-paralle,  Q=83.1
            //CirArrange = new int[,] { { 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 } };//actual, counter-paralle,  Q=83.1
            //CirArrange = new int[,] { { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 } }; //paralle-paralle, better Q=85.3
            //CirArrange = new int[,] { { 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1 } };//counter-counter,  Q=82.4
            //CirArrange = new int[,] { { 14, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13 } };//actual, counter-paralle,  Q=76
            //CirArrange = new int[,] { {16, 14, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 15 } };//actual, counter-paralle,  Q=79
            //CirArrange = new int[,] { {42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2,
            //                              1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41 } };//actual, counter-paralle,  Q=79
            //CirArrange = new int[,] { {32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2,
            //                              1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 } };//actual, counter-paralle,  Q=79

            //CirArrange = new int[,] { { 7, 8, 2, 1, 5, 3 }, {5, 8, 9, 10, 11}, {5, 88, 5, 4, 3 } };
            //CirArrange = new int[,] { { 7, 8, 2, 1, 0, 0, 0, 0 }, { 9, 10, 11, 12, 6, 5, 4, 3 } };
            //CirArrange = new int[,] { { 7, 1, 0, 0, 0, 0 }, { 8, 9, 3, 2, 0, 0 }, { 10, 11, 12, 6, 5, 4 } };
            //CirArrange = new int[,] { { 7, 8, 2, 1, 9, 10, 11, 12, 6, 5, 4, 3 } };
            //List<string> productType = new List<string>();
            //CirArrange = new int[,] { { 7, 8, 9, 3, 2, 1 }, { 12, 11, 10, 4, 5, 6 } };
            //CirArrange = new int[,] { { 7, 8, 9, 4, 5, 6 }, { 12, 11, 10, 3, 2, 1 } };
            //CirArrange = new int[,] { { 7, 8, 5, 6 }, { 10, 9, 2, 1 }, { 12, 11, 4, 3 } };
            //CirArrange = new int[,] { { 7, 8, 2, 1 }, { 10, 9, 3, 4 }, { 11, 12, 6, 5 } };
            CirArrange = new int[, ] {
                { 29, 30, 16, 15, 1, 2 }, { 32, 31, 17, 18, 4, 3 }, { 33, 34, 20, 19, 5, 6 }, { 36, 35, 21, 22, 8, 7 }, { 37, 38, 24, 23, 9, 10 }, { 40, 39, 25, 26, 12, 11 }, { 41, 42, 28, 27, 13, 14 }
            };
            CircuitNumber CircuitInfo = new CircuitNumber();

            CircuitInfo.number    = new int[] { 7, 7 };
            CircuitInfo.TubeofCir = new int[] { 6, 6, 6, 6, 6, 6, 6 };  //{ 4, 8 };
            // [19 - 17 - 15 - 13   11   9   7   5   3   1] <====Air
            // [20 - 18 - 16 - 14   12   10  8   6   4   2] <====Air
            //  Ncir=1, 20in, 20->19 1out

            //int total = 0;
            //if (CirArrange != null)
            //{
            //    foreach (var seg in CirArrange)
            //    {
            //        total += seg.
            //    }
            //}

            double mr       = 23.0 / 60;
            double Vel_a    = 1.2; //m/s
            double H        = Pt * N_tube;
            double Hx       = L * H;
            double rho_a_st = 1.2; //kg/m3

            double Va           = Vel_a * Hx;
            double ma           = Va * rho_a_st; //Va / 3600 * 1.2; //kg/s
            int    curve        = 1;             //
            double za           = 1;             //Adjust factor
            double zh           = 1;
            double zdp          = 1;
            double eta_surface  = 0.89;
            double ha           = AirHTC.alpha(Vel_a, za, curve);//71.84;//36.44;
            double tai          = 20;
            double tri          = 45;
            double tc           = tri;
            double pc           = Refrigerant.SATT(fluid, composition, tc + 273.15, 1).Pressure;
            double Pwater       = 305; //kpa
            double conductivity = 386; //w/mK for Cu
            int    hexType      = 1;   //*********************************0 is evap, 1 is cond******************************************
            //double densityL = Refrigerant.SATT(fluid, composition, te + 273.15, 1).DensityV;
            //double hri = Refrigerant.ENTHAL(fluid, composition, tri + 273.15, densityL).Enthalpy ;
            double wm = Refrigerant.WM(fluid, composition).Wm; //g/mol
            //hri = hri / wm - 140;
            double hri = Refrigerant.TPFLSH(fluid, composition, tc + 273.15, Pwater).h / wm - 0.5 - (fluid[0] == "Water" ? 0 : 140);

            //double hri = 354.6;
            //double xin = 0.57;

            double[, ,] ta = new double[Nelement, N_tube, Nrow + 1];

            //string AirDirection="DowntoUp";
            string AirDirection = "Counter";

            ta = InitialAirProperty.AirTemp(Nelement, Ntube, Nrow, tai, tc, AirDirection);

            GeometryResult geo = new GeometryResult();

            //GeometryResult[,] geo_element = new GeometryResult[,] { };
            GeometryResult[,] geo_element = new GeometryResult[N_tube, Nrow];
            for (int k = 0; k < Nrow; k++)
            {
                for (int j = 0; j < N_tube; j++)
                {
                    geo_element[j, k] = Areas.Geometry(L / Nelement, FPI[k], Do, Di, Pt, Pr, Fthickness);
                    //geo_element[i] = Areas.Geometry(L / element, FPI[i], Do, Di, Pt, Pr);
                    geo.Aa_tube += geo_element[j, k].Aa_tube;
                    geo.Aa_fin  += geo_element[j, k].Aa_fin;
                    geo.A_a     += geo_element[j, k].A_a;
                    geo.A_r     += geo_element[j, k].A_r;
                    geo.A_r_cs  += geo_element[j, k].A_r_cs;
                    //geo.A_ratio += geo_element[j,k].A_ratio;
                }
            }
            geo.A_ratio = geo.A_r / geo.A_a;

            res = Slab.SlabCalc(CirArrange, CircuitInfo, Nrow, Ntube, Nelement, fluid, composition, Di, L, geo_element, ta, tc, pc, hri,
                                mr, ma, ha, eta_surface, zh, zdp, hexType, thickness, conductivity, Pwater);

            //res = Slab.SlabCalc(Npass, N_tubes_pass, fluid, composition, Dh, L, geo.A_a, geo.A_r_cs, geo.A_r, tai, tri, pe, hri,
            //    mr, ma, ha, eta_surface, zh, zdp);
            //Tsh_calc = res.Tro - (Refrigerant.SATP(fluid, composition, res.Pro, 1).Temperature - 273.15);

            // res = Slab.SlabCalc(Npass, N_tubes_pass, fluid, composition, Dh, L, geo.A_a, geo.A_r_cs, geo.A_r, tai, tri, pe, hri,
            //     mr, ma, ha, eta_surface, zh, zdp);
            // Tsh_calc = res.Tro - (Refrigerant.SATP(fluid, composition, res.Pro, 1).Temperature - 273.15);

            return(res);
        }