Beispiel #1
0
 public WaterSplash(float xpos, float ypos, FluidData fluid)
     : base(xpos, ypos)
 {
     this._sprite = fluid.sprite == null ? new SpriteMap("waterSplash", 16, 16) : new SpriteMap(fluid.sprite + "Splash", 16, 16);
     this._sprite.AddAnimation("splash", 0.45f, false, 0, 1, 2, 3);
     this._sprite.SetAnimation("splash");
     this.center  = new Vec2(8f, 16f);
     this.graphic = (Sprite)this._sprite;
     this.depth   = new Depth(0.7f);
 }
Beispiel #2
0
        public FluidData Take(float val)
        {
            if ((double)val > (double)this.amount)
            {
                val = this.amount;
            }
            this.amount -= val;
            FluidData fluidData = this;

            fluidData.amount = val;
            return(fluidData);
        }
Beispiel #3
0
        public override void OnHoldAction()
        {
            ++this._wait;
            if (this._wait != 3)
            {
                return;
            }
            this._stream.sprayAngle = this.barrelVector * 2f;
            this._stream.position   = this.barrelPosition;
            FluidData water = Fluid.Water;

            water.amount = 0.01f;
            this._stream.Feed(water);
            this._wait = 0;
        }
Beispiel #4
0
        public void Mix(FluidData with)
        {
            float num1 = with.amount + this.amount;

            if ((double)with.amount > 0.0)
            {
                float num2 = this.amount / num1;
                float num3 = with.amount / num1;
                this.flammable   = (float)((double)num2 * (double)this.flammable + (double)num3 * (double)with.flammable);
                this.color       = this.color * num2 + with.color * num3;
                this.heat        = (float)((double)this.heat * (double)num2 + (double)with.heat * (double)num3);
                this.transparent = (float)((double)this.transparent * (double)num2 + (double)with.transparent * (double)num3);
            }
            this.amount = num1;
        }
Beispiel #5
0
        /// <summary>
        /// 初始化开始节点
        /// </summary>
        /// <param name="Coolent">冷却剂</param>
        /// <param name="totalArea">总流通面积</param>
        /// <param name="channel">计算的通道</param>
        /// <param name="massFlow">质量流速</param>
        /// <param name="Acc">计算准确度</param>
        /// <returns></returns>
        public FluidData SetInitNode(Fluid coolent, double totalArea, Channel channel, MassFlow massFlow, Precision acc)
        {
            //当前子通道入口质量流速
            double massFlowRate = massFlow.MassVelocity * channel.FlowArea / totalArea;
            //入口的参数
            double T = massFlow.Temperature;
            //压力
            double P = massFlow.Pressure;
            //密度
            double density = coolent.GetDensity(T, P);
            //比焓
            double H = coolent.GetH(T, P);
            //流速
            double velocity = massFlowRate / channel.FlowArea / density;
            //等效水力直径
            double De = 4 * channel.FlowArea / channel.WetPerimeter;
            //运动粘度
            double Kv = coolent.GetKv(T, P);
            //雷诺数
            double Re = velocity * De / Kv;
            //普朗特数
            double Pr = coolent.GetPr(T, P);
            //导热系数
            double K = coolent.GetK(T, P);
            //对流换热系数
            double h = h_convect(Re, Pr, K, De);
            //饱和液体比焓
            double Hf = coolent.GetHf(P);
            //饱和蒸汽比焓
            double Hg = coolent.GetHg(P);
            //热平衡寒气率
            double Xe = (H - Hf) / (Hg - Hf);
            //新建节点对象
            FluidData InitNode = new FluidData(0, T, H, density, velocity, massFlowRate, P, h, Pr, Re, K, Kv, 0, Xe, acc);

            return(InitNode);
        }
Beispiel #6
0
        /// <summary>计算稳态平均通道(单通道)</summary>
        public void Caculate_General_Flow()
        {
            MsgCenter.ShowMessage("计算基本流动数据...");
            //存放计算结果的集合
            List <FluidData> fluid_datas = new List <FluidData>();
            //平均通道
            Channel ch = new Channel
            {
                FlowArea     = TotalArea,
                HotPerimeter = TotalLh,
                WetPerimeter = TotalLw,
            };
            //初始化子通道入口数据节点
            FluidData InitNode = SetInitNode(Coolent, TotalArea, ch, MassFlow, Acc);

            //初始节点添加到计算结果集合
            fluid_datas.Add(InitNode);
            //计算平均流,Nj为轴向分段数,循环1~Nj个节点(外加初始节点1个共Nj+1个)
            for (int j = 1; j < Nj + 1; j++)
            {
                //获得上一个节点数据Previous
                FluidData pre = fluid_datas[j - 1];
                //计算第j个节点的数据(第j段,共J段),根据入口温度求出比焓
                double Hin = Coolent.GetH(pre.Temperature, pre.Pressure);
                //总线功率,累加所有燃料棒功率份额
                double TotalSubPower = 0;
                //遍历所有燃料棒
                foreach (Rod rod in Rods)
                {
                    //遍历所有与此燃料棒接触的子通道
                    foreach (var contact_chl in rod.ContactedChannel)
                    {
                        //总的线功率+=燃料功率*功率份额(因存在对称边界半根燃料棒计算的算例)
                        TotalSubPower += rod.SubPowerCollection[j - 1].Value * contact_chl.Angle / 360;
                    }
                }
                //总线功率 X 功率因子
                TotalSubPower = TotalSubPower * PowerFactor;
                //获取当前段的长度,选择一个燃料棒进行计算
                double Lj = Rods[0].SubPowerCollection[j - 1].To - Rods[0].SubPowerCollection[j - 1].From;
                //推算下一个节点
                FluidData next = NodeToNext(
                    Coolent,
                    pre,
                    ch,
                    Lj,
                    TotalSubPower,
                    pre.MassFlowRate,
                    Acc,
                    out double P,
                    CHF_formula,
                    Flow_Direction);
                //节点添加到集合
                fluid_datas.Add(next);
                //将集合给MyIOManager
                MyIOManager.OutputData.SteadyResult.GeneralFlow = new GeneralFlow
                {
                    FluidDatas = fluid_datas,
                };
            }
        }
Beispiel #7
0
        /// <summary>
        /// 计算稳态子通道流量场,使用节点压力迭代,即用压力平衡思想考虑横向流动
        /// </summary>
        /// <param name="coolent">冷却剂</param>
        /// <param name="channels">通道集合</param>
        /// <param name="rods">燃料棒集合</param>
        /// <param name="massFlow">质量流速对象</param>
        /// <param name="Ni">通道数</param>
        /// <param name="Nj">轴向分段数</param>
        /// <param name="totalArea">总流通面积</param>
        /// <param name="options">计算选项</param>
        /// <returns></returns>
        public List <ChannelFlow> Caculate_Channels_Steady_NodeIteration(
            Fluid coolent,
            List <Channel> channels,
            List <Rod> rods,
            MassFlow massFlow,
            int Ni, int Nj,
            double totalArea,
            Options options)
        {
            ///使用压力迭代方法确定不同子通道之间的流量,此计算方法使用压力迭代确定
            ///
            Main.MsgCenter.ShowMessage("计算子通道数据,流量计算方式压力迭代:节点迭代...");
            //初始化输出结果
            List <ChannelFlow> channelsFlow = new List <ChannelFlow>();

            for (int i = 0; i < Ni; i++)
            {
                ChannelFlow channelFlow = new ChannelFlow
                {
                    //流动计算结果 编号与输入的子通道编号相对应
                    ChannelIndex = channels[i].Index,
                    FluidDatas   = new List <FluidData>()
                };
                for (int j = 0; j < Nj + 1; j++)
                {
                    channelFlow.FluidDatas.Add(new FluidData());
                }
                channelsFlow.Add(channelFlow);
            }
            //迭代的限制参数
            Iteration iteration = options.Iteration;
            //功率的乘子
            PowerFactor powerFactor = options.PowerFactor;
            //计算的准确度
            Precision acc = options.Precision;
            //CHF公式选取
            CHF_Formula_Types chf_formula = options.DNBR_Formula;
            //流动方向(-1~1)
            double flow_direction = massFlow.Flow_Direction;

            //质量流量迭代
            var MassFlowRate = Matrix <double> .Build.Dense(Nj + 1, Ni, 0);

            //每个子通道的分段压降,Ni行xNj列初值为0
            var P_Local = Matrix <double> .Build.Dense(Nj + 1, Ni, 0);

            //压降迭代因子
            double Sigma = 0;

            //质量流速迭代中间变量
            double[] m = new double[Ni];
            //质量流速迭代中间变量
            double[] velocity = new double[Ni];
            //质量流速迭代中间变量
            double[] DeltaP = new double[Nj];
            //遍历所有子通道
            for (int i = 0; i < Ni; i++)
            {
                //初始化j=0入口节点
                FluidData InitNode = SetInitNode(coolent, totalArea, channels[i], massFlow, acc);
                //初始化子通道数据节点加入
                channelsFlow[i].FluidDatas[0] = InitNode;
                //局部压力场矩阵(Mpa)
                P_Local[0, i] = InitNode.Pressure;
                //质量流速kg/s 迭代用)
                m[i] = InitNode.MassFlowRate;
                //流速m/s(迭代用)
                velocity[i] = InitNode.Velocity;
                //质量流速矩阵(输出用)
                MassFlowRate[0, i] = m[i];
            }
            //轴向迭代
            for (int j = 1; j < Nj + 1; j++)
            {
                //迭代次数
                int iteration_times = 0;
                do
                {
                    //计算所有燃料棒j段(J=1~Nj-1)
                    for (int i = 0; i < Ni; i++)
                    {
                        //计算当前段的长度j>=1
                        double Lj = rods[0].SubPowerCollection[j - 1].To - rods[0].SubPowerCollection[j - 1].From;
                        //前一个节点
                        FluidData pre = channelsFlow[i].FluidDatas[j - 1];
                        //当前子通道燃料棒功率输出
                        double SubPowerJ = 0;
                        //遍历所有燃料棒
                        foreach (Rod rod in rods)
                        {
                            //燃料棒所有接触的通道
                            foreach (var ContactedChannel in rod.ContactedChannel)
                            {
                                //如果与燃料棒接触的通道,如果是当前正在计算的通道
                                if (ContactedChannel.Index == channels[i].Index)
                                {
                                    SubPowerJ += rod.SubPowerCollection[j - 1].Value * ContactedChannel.Angle / 360;
                                }
                            }
                        }
                        //乘以功率因子
                        SubPowerJ = SubPowerJ * powerFactor.Multiplier;
                        //计算新节点,NodeToNext计算子通道节点
                        FluidData next = NodeToNext(
                            coolent,
                            pre,
                            channels[i],
                            Lj,
                            SubPowerJ,
                            m[i],
                            acc,
                            out double DeltaPij,
                            chf_formula,
                            flow_direction);
                        //迭代中间变量赋值
                        DeltaP[i] = DeltaPij;
                        //存储计算结果
                        channelsFlow[i].FluidDatas[j] = next;
                        //i棒j段压降
                        P_Local[j, i] = next.Pressure;
                        //质量流速
                        MassFlowRate[j, i] = m[i];
                    }

                    //初始化迭代收敛因子
                    Sigma = 0;
                    //平均压降
                    double AvgPressure = 0;
                    for (int i = 0; i < Ni; i++)
                    {
                        AvgPressure += DeltaP[i];
                    }
                    //平均压降
                    AvgPressure = AvgPressure / Ni;
                    // 所有偏差之和
                    for (int i = 0; i < Ni; i++)
                    {
                        Sigma += Math.Abs(DeltaP[i] - AvgPressure);
                    }
                    //总质量流速
                    double TotalM = 0;
                    for (int i = 0; i < Ni; i++)
                    {
                        //子通道i压降和平均压降的比值
                        double Factor = (1 - DeltaP[i] / AvgPressure) * 0.1;
                        //重新分配压降
                        m[i] = m[i] + m[i] * Factor;

                        TotalM += m[i];

                        Debug.WriteLine(String.Format("因子{0}:", Factor));
                    }
                    //计算平衡后与平衡前的比值
                    double k = massFlow.MassVelocity / TotalM;
                    //保持总质量流速不变
                    for (int i = 0; i < Ni; i++)
                    {
                        //对质量流量进行修正
                        m[i] = k * m[i];
                        Debug.WriteLine(String.Format("通道{0}压降{1}Pa", i, DeltaP[i]));
                    }
                    Debug.WriteLine("=========================================");
                    //迭代压降
                    iteration_times += 1;
                    Main.MsgCenter.ShowMessage(String.Format("压力迭代次数:{0}", iteration_times));
                    if (iteration_times > iteration.MaxIteration)
                    {
                        Main.MsgCenter.ShowMessage(String.Format("超过最大迭代次数限制,最大迭代次数限制{0}", iteration.MaxIteration));
                        break;
                    }
                }while (Sigma > iteration.Sigma);
                //循环每个通道
                Main.MsgCenter.ShowMessage(String.Format("Sigma->{0}", Sigma));
            }
            //信息输出
            Main.MsgCenter.ShowMessage("--------压力场预览--------");
            Main.MsgCenter.ShowMessage(P_Local.ToMatrixString(Nj + 1, Ni));
            Main.MsgCenter.ShowMessage("--------流量场预览--------");
            Main.MsgCenter.ShowMessage(MassFlowRate.ToMatrixString(Nj + 1, Ni));

            return(channelsFlow);
        }
Beispiel #8
0
        /// <summary>
        /// 计算稳态子通道流量场,使用进出口压力迭代,即不考虑横向流动
        /// </summary>
        /// <param name="coolent">冷却剂</param>
        /// <param name="channels">通道集合</param>
        /// <param name="rods">燃料棒集合</param>
        /// <param name="massFlow">质量流速对象</param>
        /// <param name="Ni">通道数</param>
        /// <param name="Nj">轴向分段数</param>
        /// <param name="totalArea">总流通面积</param>
        /// <param name="options">计算选项</param>
        /// <returns></returns>
        public List <ChannelFlow> Caculate_Channels_Steady_IOIteration(
            Fluid coolent,
            List <Channel> channels,
            List <Rod> rods,
            MassFlow massFlow,
            int Ni, int Nj,
            double totalArea,
            Options options)
        {
            ///使用压力迭代方法确定稳态不同子通道之间的流量,此计算方法使用压力迭代确定
            ///一些局部变量
            ///

            //初始化输出结果
            List <ChannelFlow> channelsFlow = new List <ChannelFlow>();

            for (int i = 0; i < Ni; i++)
            {
                ChannelFlow channelFlow = new ChannelFlow
                {
                    //流动计算结果 编号与输入的子通道编号相对应
                    ChannelIndex = channels[i].Index,
                    FluidDatas   = new List <FluidData>()
                };
                for (int j = 0; j < Nj + 1; j++)
                {
                    channelFlow.FluidDatas.Add(new FluidData());
                }
                channelsFlow.Add(channelFlow);
            }
            //迭代的限制参数
            Iteration iteration = options.Iteration;
            //功率的乘子
            PowerFactor powerFactor = options.PowerFactor;
            //计算的准确度
            Precision acc = options.Precision;
            //CHF公式选取
            CHF_Formula_Types chf_formula = options.DNBR_Formula;
            //流动方向(-1~1)
            double flow_direction = massFlow.Flow_Direction;

            //压降迭代,每个子通道的压降
            double[] DeltaP = new double[Ni];
            //压降迭代,每个子通道的压降
            double[] m = new double[Ni];
            //每个子通道的分段压降,Ni行xNj列初值为0
            Matrix <double> P_Local = Matrix <double> .Build.Dense(Nj + 1, Ni, 0);

            //压降迭代收敛因子
            double Sigma = 0;
            //迭代次数统计
            int iteration_times = 0;

            //迭代压降
            do
            {
                //遍历子通道
                for (int i = 0; i < Ni; i++)
                {
                    //初始化压降
                    DeltaP[i] = 0;
                    //初始化子通道入口数据节点
                    FluidData InitNode = SetInitNode(coolent, totalArea, channels[i], massFlow, acc);
                    //初始化子通道数据节点加入
                    channelsFlow[i].FluidDatas[0] = InitNode;
                    //局部压力场矩阵
                    P_Local[0, i] = InitNode.Pressure;
                    if (iteration_times <= 1)
                    {
                        //质量流速
                        m[i] = InitNode.MassFlowRate;
                    }
                    //每个通道数据节点(共Nj+1个,初始节点1个,循环Nj个)
                    for (int j = 1; j < Nj + 1; j++)
                    {
                        //计算当前段的长度j>=1
                        double Lj = rods[0].SubPowerCollection[j - 1].To - rods[0].SubPowerCollection[j - 1].From;
                        //前一个节点
                        FluidData pre = channelsFlow[i].FluidDatas[j - 1];
                        //当前子通道燃料棒功率输出
                        double SubPowerJ = 0;
                        //遍历所有燃料棒
                        foreach (Rod rod in rods)
                        {
                            //燃料棒所有接触的通道
                            foreach (var ContactedChannel in rod.ContactedChannel)
                            {
                                //如果与燃料棒接触的通道,如果是当前正在计算的通道
                                if (ContactedChannel.Index == channels[i].Index)
                                {
                                    SubPowerJ += rod.SubPowerCollection[j - 1].Value * ContactedChannel.Angle / 360;
                                }
                            }
                        }
                        //乘以功率因子
                        SubPowerJ = SubPowerJ * powerFactor.Multiplier;
                        //计算新节点,NodeToNext计算子通道节点
                        FluidData next = NodeToNext(
                            coolent,
                            pre,
                            channels[i],
                            Lj,
                            SubPowerJ,
                            m[i],
                            acc,
                            out double DeltaPij,
                            chf_formula,
                            flow_direction);
                        //存储计算结果
                        channelsFlow[i].FluidDatas[j] = next;
                        //i棒j段压降
                        P_Local[j, i] = next.Pressure;
                        //压降用于迭代
                        DeltaP[i] += DeltaPij;
                    }
                }
                //初始化迭代收敛因子Sigma
                Sigma = 0;
                //平均压降
                double AvgPressure = 0;
                for (int i = 0; i < Ni; i++)
                {
#if DEBUG
                    Main.MsgCenter.ShowMessage(String.Format("通道{0}压降:{1}", i, DeltaP[i]));
#endif
                    AvgPressure += DeltaP[i];
                }
                //平均压降
                AvgPressure = AvgPressure / Ni;
                //所有偏差之和
                for (int i = 0; i < Ni; i++)
                {
                    Sigma += Math.Abs(DeltaP[i] - AvgPressure);
                }
                double TotalM = 0;
                for (int i = 0; i < Ni; i++)
                {
                    //子通道i压降和平均压降的比值
                    double Factor = Math.Sqrt(AvgPressure / DeltaP[i]);
                    //重新分配压降
                    m[i] = Factor * m[i]; // 所有偏差之和
                                          //计算平衡后的总质量流速
                    TotalM += m[i];
                }
                //计算平衡后与平衡前的比值
                double k = massFlow.MassVelocity / TotalM;
                //对质量流量进行修正,保持总质量流速不变
                for (int i = 0; i < Ni; i++)
                {
                    m[i] = k * m[i];
#if DEBUG
                    Main.MsgCenter.ShowMessage(String.Format("通道{0}质量流速:{1}", i, m[i]));
#endif
                }
                //输出迭代收敛因子
                Main.MsgCenter.ShowMessage(String.Format("Sigma->{0}", Sigma));
                //迭代次数+1
                iteration_times += 1;
                Main.MsgCenter.ShowMessage(String.Format("压力迭代次数:{0}", iteration_times));
                if (iteration_times > iteration.MaxIteration)
                {
                    Main.MsgCenter.ShowMessage(String.Format("超过最大迭代次数限制,最大迭代次数限制{0}", iteration.MaxIteration));
                    break;
                }
            }while (Sigma > iteration.Sigma);



            // MyIOManager.OutputData.SteadyResult.ChannelsFlow = ChannelsFlow;
            //信息输出
            Main.MsgCenter.ShowMessage("--------压力场预览--------");
            Main.MsgCenter.ShowMessage(P_Local.ToMatrixString(Nj + 1, Ni));

            Main.MsgCenter.ShowMessage("--------流量场预览--------");
            var MassFlowRate = Matrix <double> .Build.Dense(Nj + 1, Ni, (Mi, Mj) => m[Mj]);

            Main.MsgCenter.ShowMessage(MassFlowRate.ToMatrixString(Nj + 1, Ni));

            return(channelsFlow);
        }
Beispiel #9
0
        /// <summary>
        /// 计算下一个节点的数据
        /// </summary>
        /// <param name="coolent">冷却剂 对象模型</param>
        /// <param name="income">入口流动节点 上一个节点的数据</param>
        /// <param name="channel">所要计算的通道模型</param>
        /// <param name="Lj">长度m</param>
        /// <param name="power">线功率。W/m</param>
        /// <param name="massVelocity">质量流速(kg/s)</param>
        /// <param name="deltaP">压降Pa *这是个返回值*</param>
        /// <param name="flowDirection">流动方向(-1~1)</param>
        /// <returns></returns>
        internal FluidData NodeToNext(
            Fluid coolent, FluidData income, Channel channel, double Lj,
            double power, double massVelocity, Precision Acc, out double deltaP,
            CHF_Formula_Types chf_formula, double flowDirection = 1)
        {
            ///****根据根据流体比焓和功率关系,从一个节点数据,计算下一个节点。
            ///****输出模型中,压力单位是Mpa,压降计算中,压力单位为Pa,注意单位转换

            //等效水力直径
            double De = 4 * channel.FlowArea / channel.WetPerimeter;
            //入口比焓
            double Hin = coolent.GetH(income.Temperature, income.Pressure);
            //计算出口比焓
            double Hout = Hin + power * 0.001 * Lj / income.MassFlowRate;
            //入口压力(压力显示单位为Mpa,计算单位使用pa)
            double Pin = income.Pressure;
            //出口压力
            double Pout = Pin;
            //入口位置
            double pos_in = income.Position;
            //出口位置
            double pos_out = pos_in + Lj;
            //入口温度
            double Tin = income.Temperature;
            //出口温度
            double Tout = coolent.GetT(Hout, Pout);
            //出口节点流体密度
            double density = coolent.GetDensity(Tout, Pout);
            //出口流速
            double velocity = massVelocity / channel.FlowArea / density;
            //运动粘度
            double Kv = coolent.GetKv(Tout, Pout);
            //雷诺数
            double Re = velocity * De / Kv;
            //普朗特数
            double Pr = coolent.GetPr(Tout, Pout);
            //导热系数
            double K = coolent.GetK(Tout, Pout);
            //重力压降
            double Ph = density * G * Lj * flowDirection;
            //摩擦压降
            double Pf = FrictionFactor(Re) * Lj / De * density * velocity * velocity * 0.5;
            //加速压降
            double Pa = density * (velocity + income.Velocity) * (velocity - income.Velocity) * 0.5;

            //总压降
            deltaP = (Ph + Pf + Pa);
            //出口节点压力,显示单位是Mpa
            Pout = Pin - deltaP * 0.000001;
            ///计算临界热流密度
            //饱和液体比焓
            double Hf = coolent.GetHf(Pin);
            //饱和蒸汽比焓
            double Hg = coolent.GetHg(Pin);
            //热平衡寒气率
            double Xe = (Hout - Hf) / (Hg - Hf);
            //计算临界热流密度
            double Qc = Q_Critical(Xe, De, velocity * density, Hf, Hout, chf_formula);
            //本地临界热流密度
            double Ql = power / channel.HotPerimeter;
            //DNBR默认保留三位小数点
            double DNBR = Qc / Ql;
            //对流换热系数
            double    h       = h_convect(Re, Pr, K, De, DNBR);
            FluidData outcome = new FluidData
            {
                //出口比焓
                Enthalphy = Math.Round(Hout, Acc.H),
                //先预定压力为入口节点的压力
                Pressure = Math.Round(Pout, Acc.Pressure + 6),
                //出口温度
                Temperature = Math.Round(Tout, Acc.T),
                //节点位置
                Position = pos_out,
                //质量流速
                MassFlowRate = Math.Round(massVelocity, Acc.MassFlowRate),
                //流体密度
                Density = Math.Round(density, Acc.Density),
                //出口流速
                Velocity = Math.Round(velocity, Acc.Velocity),
                //运动粘度
                Kv = Math.Round(Kv, Acc.Kv),
                //雷诺数
                Re = Math.Round(Re, Acc.Re),
                //普朗特数
                Pr = Math.Round(Pr, Acc.Pr),
                //导热系数
                K = Math.Round(K, Acc.K),
                //烧毁比
                DNBR = Math.Round(DNBR, 3),
                //对流换热系数
                h = Math.Round(h, Acc.h),
                //热平衡含气率 -1~1     ·
                Xe = Math.Round(Xe, 3),
            };

#if DEBUG
            if (Hout < 0 | density < 0 | Pout < 0 | Pf < 0)
            {
                string MsgHeader = "-----[Fatal error]计算出现错误(出现负值),请查看下面的调试信息-----";
                string MsgBody   = "";
                MsgBody += "入口数据\n";
                foreach (PropertyInfo item in income.GetType().GetProperties())
                {
                    MsgBody += item.Name + ":" + item.GetValue(income, null) + "\n";
                }
                MsgBody += "出口数据\n";
                foreach (PropertyInfo item in outcome.GetType().GetProperties())
                {
                    MsgBody += item.Name + ":" + item.GetValue(outcome, null) + "\n";
                }
                MsgBody += "通道数据\n";
                foreach (PropertyInfo item in channel.GetType().GetProperties())
                {
                    MsgBody += item.Name + ":" + item.GetValue(channel, null) + "\n";
                }
                MsgBody += "压降数据\n";
                MsgBody += "Ph:" + Ph + "\n";
                MsgBody += "Pf:" + Pf + "\n";
                MsgBody += "Pa:" + Pa + "\n";
                Debug.WriteLine(MsgHeader);
                Debug.WriteLine(MsgBody);
                //throw new Exception("计算出现错误(出现负值),请查看调试信息");
            }
#endif

#if !DEBUG
            if (Hout < 0 | density < 0 | Pout < 0 | Pf < 0)
            {
                string MsgHeader = "-----[Fatal error]计算出现错误(出现负值),请查看下面的调试信息-----";
                string MsgBody   = "";
                MsgBody += "入口数据\n";
                foreach (PropertyInfo item in income.GetType().GetProperties())
                {
                    MsgBody += item.Name + ":" + item.GetValue(income, null) + "\n";
                }
                MsgBody += "出口数据\n";
                foreach (PropertyInfo item in outcome.GetType().GetProperties())
                {
                    MsgBody += item.Name + ":" + item.GetValue(outcome, null) + "\n";
                }
                MsgBody += "通道数据\n";
                foreach (PropertyInfo item in channel.GetType().GetProperties())
                {
                    MsgBody += item.Name + ":" + item.GetValue(channel, null) + "\n";
                }
                MsgBody += "压降数据\n";
                MsgBody += "Ph:" + Ph + "\n";
                MsgBody += "Pf:" + Pf + "\n";
                MsgBody += "Pa:" + Pa + "\n";
                Main.MsgCenter.ShowMessage(MsgHeader);
                Main.MsgCenter.ShowMessage(MsgBody);
            }
#endif
            return(outcome);
        }