| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 424 人关注过本帖
标题:为什么程序运行之后 A,beita 和 ReD2 的值都是非数字呢?弄了一下午了没有 ...
只看楼主 加入收藏
yunchao22022
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-1-19
结帖率:0
收藏
 问题点数:0 回复次数:0 
为什么程序运行之后 A,beita 和 ReD2 的值都是非数字呢?弄了一下午了没有弄出来,求指点迷津
程序代码如下,求大神告诉错误所在,debug了一下午了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    class Class1
    {
        public double t, p, D20, d20,A,Dt,dt,dp,ReD2,beita;
        public double lanmuda_D = 12.78E-6f;
        public double lanmuda_d = 17.2E-6;
        public double rou1 = 855.69;
        public double nang = 126.93E-6;
        public double yu = 1;
        public double pi = 3.1415927;
        public double get_Dt(double D20, double lanmuda_d, double t)
        {
            double Dt = D20 * (1 + lanmuda_D * (t - 20));
            Console.WriteLine("孔板使用温度下的管内径是: " + Dt);
            return Dt;
        }
        public double get_dt(double d20, double lanmuda_d, double t)
        {
            double dt = d20 * (1 + lanmuda_d * (t - 20));
            Console.WriteLine("孔板使用温度下的节流件孔径是:" + dt);
            return dt;
        }

        public double get_beita(double dt, double Dt)
        {
            double beita = dt / Dt;
            Console.WriteLine("beita=" + beita);
            this.beita = beita;
            return beita;
        }


        public double get_A(double rou1, double nang, double dp, double beita)
        {
            double A = yu * dt * dt * Math.Sqrt(2 * rou1 * dp) / (nang * Dt * Math.Sqrt(1 - beita * beita * beita * beita));
            Console.WriteLine("A=" + A);
            this.A = A;
            return A;
        }
        public void test1(double beita, double A)
        {
            double ReD1, ReD2, C1, C2, C0;
            C0 = 0.60299;
            ReD1 = A * C0;
            C1 = C0 + 0.0029 * Math.Pow(beita, 2.5) * Math.Pow((1E6 / ReD1), 0.75);
            ReD2 = A * C1;
            C2 = C0 + 0.0029 * Math.Pow(beita, 2.5) * Math.Pow((1E6 / ReD2), 0.75);
            while (Math.Abs((A - ReD2 / C2) / A) < 5E-5)
            {
                A = ReD2 / C2;
                ReD1 = A * C0;
                C1 = C0 + 0.0029 * Math.Pow(beita, 2.5) * Math.Pow((1E6 / ReD1), 0.75);
                ReD2 = A * C1;
                C2 = C0 + 0.0029 * Math.Pow(beita, 2.5) * Math.Pow((1E6 / ReD2), 0.75);
            }
            Console.WriteLine("ReD2=" + ReD2);
        }
        public double get_qm(double pi, double Dt, double ReD2)
        {

            double qm = nang * Dt * ReD2 * pi / 4;
            Console.WriteLine("流量qm=" + qm);
            return 0;
        }
        public static void Main()
        {
            double t = 215f;
            double D20 = 150f;
            double d20 = 95.59f;

            double pi = 3.1415926f;
            double nang = 126.93E-6; ;
            double beita, A;
            double rou1 = 855.69;
            Class1 myclass = new Class1();
            myclass.t = 215;
            myclass.D20 = 150;
            myclass.d20 = d20;
            myclass.pi = pi;
            myclass.nang = nang;
            myclass.rou1 = rou1;
            myclass.get_Dt(myclass.D20, myclass.lanmuda_D, myclass.t);
            myclass.get_dt(myclass.d20, myclass.lanmuda_d, myclass.t);
            myclass.get_qm(myclass.pi, myclass.Dt, myclass.ReD2);
            beita = myclass.get_beita(myclass.dt, myclass.Dt);
            A = myclass.get_A(myclass.rou1, myclass.nang, myclass.dp, beita);
            myclass.test1(beita, A);




        }
    }
}

















搜索更多相关主题的帖子: public double 
2014-04-23 20:09
快速回复:为什么程序运行之后 A,beita 和 ReD2 的值都是非数字呢?弄了一下午了 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017494 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved