From 3024f6d3d1618d8e90082f5aec0cc1bb6fabeea6 Mon Sep 17 00:00:00 2001
From: tangxu <tangxu76880903>
Date: 星期四, 24 十月 2024 09:32:12 +0800
Subject: [PATCH] 添加测试

---
 WinFrmUI/DPumpHydr.WinFrmUI.Volute/断面设计/ViewModel/SectionShapePara.cs |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 120 insertions(+), 0 deletions(-)

diff --git "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ViewModel/SectionShapePara.cs" "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ViewModel/SectionShapePara.cs"
index 1cec45a..3da1b86 100644
--- "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ViewModel/SectionShapePara.cs"
+++ "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ViewModel/SectionShapePara.cs"
@@ -21,5 +21,125 @@
         public double SectionArea { get; set; }//闈㈢Н:鐢眔cc璁$畻
         public double BaseWidth { get; set; }//搴曢儴瀹藉害 灏辨槸B3
         public double BaseCircleRadius { get; set; }//搴曢儴鍦嗗崐寰� 灏辨槸D3/2
+
+        /// <summary>
+        /// 鏍规嵁闈㈢Н璁$畻楂樺害
+        /// </summary>
+        public double CalcHeightByArea(eSectionShapeType SectionType)
+        { 
+            double a = (Math.Tan(Gama_Left * Math.PI / 180) + Math.Tan(Gama_Right * Math.PI / 180)) / 2;
+            double b = BaseWidth;
+            double c = (90 + Gama_Right) / 360 * Math.PI * R_Left * R_Left + (90 + Gama_Left) / 360 * Math.PI * R_Right * R_Right
+                - R_Left * R_Left * Math.Tan((45 + Gama_Right / 2) * Math.PI / 180) - R_Right * R_Right * Math.Tan((45 + Gama_Left / 2) * Math.PI / 180) - SectionArea;
+            double delta = b * b - 4 * a * c;
+            if (delta < 0) return -1; 
+            if ( SectionType ==  eSectionShapeType.鐭╁舰 )//鐭╁舰
+            {
+                return  -c / b;
+            }
+            else
+            {
+                if (delta < 0) return  -1;
+                return  (-b + Math.Sqrt(delta)) / (2 * a);
+            }
+        }
+
+        private double DecreaseR = 0.5;
+        public bool  CalculateR(eSectionShapeType SectionType, HdrBaseInfo BaseInfo, bool isFirst)
+        {
+            if (!isFirst)
+            {
+                R_Left = R_Left - DecreaseR;
+                R_Right = R_Right - DecreaseR;
+
+                if (R_Left > (H - 1))
+                    R_Left = Math.Round(H * 0.85 - 1,0);
+                if (R_Right > (H - 1))
+                    R_Right = Math.Round(H * 0.85 - 1,0);
+
+                if (R_Left < 2)
+                    R_Left = 2;
+                if (R_Right < 2)
+                    R_Right = 2;
+            }
+            else//鏄涓�娆¤绠�
+            {
+                //璧嬪�硷細R1 R2 R3 R4
+                if (SectionType ==  eSectionShapeType.瀵圭О) //type锛�0锛氬绉版褰�
+                    R_Left = Math.Round(BaseWidth * 0.55 + 0.5  - 4,0);
+                else if (SectionType == eSectionShapeType.涓嶅绉�)//type锛�1锛氫笉瀵圭О姊舰
+                    R_Left = Math.Round(BaseWidth * 0.55 + 0.5  - 4,0);
+                else if (SectionType == eSectionShapeType.鐭╁舰)//type锛�2锛氱煩褰�
+                    R_Left = Math.Round(BaseWidth * 0.4 + 0.5  - 2,0);
+
+
+                if (BaseInfo.IsSXB)
+                    R_Left = Math.Round(R_Left / 2,0);
+                //if (DesignMode == YSSnxOpen::DesignMode::AssPawuQnshQw1)
+                //{
+                //    R_Left = int(R_Left * 0.7);
+                //}
+                double m_R3 = 0;
+                double t = 0;
+                if (BaseWidth <= 35)
+                    m_R3 = 5;
+                else if (BaseWidth <= 60 && BaseWidth > 35)
+                {
+                    t = Math.Round(BaseWidth * 0.6, 0) - Math.Round(BaseWidth * 0.6 / 10.0, 0) * 10;
+                    if (t <= 2)
+                        m_R3 = Math.Round(BaseWidth * 0.6 / 10.0, 0) * 10;
+                    else if (t > 2 && t <= 7)
+                        m_R3 = Math.Round(BaseWidth * 0.6 / 10.0, 0) * 10 + 5;
+                    else if (t > 7)
+                        m_R3 = Math.Round(BaseWidth * 0.6 / 10.0, 0) * 10 + 10;
+                }
+                else if (BaseWidth > 60 && BaseWidth <= 90)
+                {
+                    t = Math.Round(BaseWidth * 0.9, 0) - Math.Round(BaseWidth * 0.9 / 10.0, 0) * 10;
+                    if (t <= 2)
+                        m_R3 = Math.Round(BaseWidth * 0.9 / 10.0, 0) * 10;
+                    else if (t > 2 && t <= 7)
+                        m_R3 = Math.Round(BaseWidth * 0.9 / 10.0, 0) * 10 + 5;
+                    else if (t > 7)
+                        m_R3 = Math.Round(BaseWidth * 0.9 / 10.0, 0) * 10 + 10;
+                }
+                else if (BaseWidth > 90)
+                {
+                    t = Math.Round(BaseWidth * 0.3, 0) - Math.Round(BaseWidth * 0.3 / 10.0, 0) * 10;
+                    if (t <= 2)
+                        m_R3 = Math.Round(BaseWidth * 0.3 / 10.0, 0) * 10;
+                    else if (t > 2 && t <= 7)
+                        m_R3 = Math.Round(BaseWidth * 0.3 / 10.0, 0) * 10 + 5;
+                    else if (t > 7)
+                        m_R3 = Math.Round(BaseWidth * 0.3 / 10.0, 0) * 10 + 10;
+                }
+
+                R_Right = R_Left;
+                R_out = 1000.0;
+
+                //鎴潰R1 鍜� R4鐨勫噺灏戣搴� DecreaseR
+                if (BaseWidth < 15)
+                {
+                    DecreaseR = 0.5;
+                }
+                else if (BaseWidth >= 15 && BaseWidth < 25)
+                {
+                    DecreaseR = 1;
+                }
+                else if (BaseWidth >= 25 && BaseWidth < 45)
+                {
+                    DecreaseR = 1.5;
+                }
+                else if (BaseWidth >= 45)
+                {
+                    DecreaseR = 2;
+                }
+
+                if (BaseInfo.IsSXB)
+                    DecreaseR = 1;
+            }
+
+            return true;
+        }
     }
 }

--
Gitblit v1.9.3