1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
namespace Yw.Geometry
{
    public class EquipCurveHelper
    {
        /// <summary>
        /// 根据流量扬程线,以及给定设计点, 返回交点和装置曲线
        /// </summary>
        /// <param name="qh"></param>
        /// <param name="design_pt"></param>
        /// <param name="sect_pt"></param>
        /// <returns></returns>
        static public Yw.Geometry.EquipCurveParas CalcEquipCurve(
             Yw.Geometry.CubicSpline2d qh,
             Yw.Geometry.Point2d design_pt,
             out Yw.Geometry.Point2d sect_pt)
        {
            return CalcEquipCurve(qh, design_pt, 0, false, 11, out sect_pt);
        }
 
        /// <summary>
        /// 根据流量扬程线,以及给定设计点,以及装置曲线0流量时的扬程点, 返回交点和装置曲线
        /// </summary>
        /// <param name="qh"></param>
        /// <param name="design_pt"></param>
        /// <param name="eq_zero_h"></param>
        /// <param name="sect_pt"></param>
        /// <returns></returns>
        static public Yw.Geometry.EquipCurveParas CalcEquipCurve(
             Yw.Geometry.CubicSpline2d qh,
             Yw.Geometry.Point2d design_pt,
             double eq_zero_h,
             out Yw.Geometry.Point2d sect_pt)
        {
            return CalcEquipCurve(qh, design_pt, eq_zero_h, false, 11, out sect_pt);
        }
        /// <summary>
        /// 根据流量扬程线,以及给定设计点,以及装置曲线0流量时的扬程点, 返回交点和装置曲线
        /// </summary>
        /// <param name="qh"></param>
        /// <param name="design_pt"></param>
        /// <param name="eq_zero_h"></param>
        /// <param name="is_exend"></param>
        /// <param name="fit_pt_count"></param>
        /// <param name="sect_pt"></param>
        /// <returns></returns>
        static public Yw.Geometry.EquipCurveParas CalcEquipCurve(
             Yw.Geometry.CubicSpline2d qh,
             Yw.Geometry.Point2d design_pt,
             double eq_zero_h,
             bool is_exend,//当design_pt超过曲线时, 是否延长装置线到design_pt位置
             int fit_pt_count,
             out Yw.Geometry.Point2d sect_pt)
        {
            sect_pt = GetSectPoint(qh, design_pt, eq_zero_h);
            if (sect_pt == null)
            {
                return null;
            }
            if (is_exend)
            {
                Yw.Geometry.Point2d end_pt;
                if (sect_pt.X > design_pt.X)
                    end_pt = sect_pt;
                else
                    end_pt = design_pt;
 
                //
                return new Yw.Geometry.EquipCurveParas(eq_zero_h, end_pt, fit_pt_count);
            }
            else
            {
                return new Yw.Geometry.EquipCurveParas(eq_zero_h, sect_pt, fit_pt_count);
            }
        }
 
        /// <summary>
        /// 计算装置曲线与流量扬程曲线的交点
        /// </summary>
        /// <param name="qh"></param>
        /// <param name="design_pt"></param>
        /// <param name="eq_zero_h"></param>
        /// <returns></returns>
        static public Yw.Geometry.Point2d GetSectPoint(
            Yw.Geometry.CubicSpline2d qh,
            Yw.Geometry.Point2d design_pt,
            double eq_zero_h)
        {//有一种情况: 用包络法有交点(在最末尾),但用装置曲线绘制时,与装置曲线没有交点,因为交点已超过曲线最大值
            double ratio_extend = 1.15;//CurveExpressQH适当延长一点
            var sect_pt = Yw.Geometry.ParabolaCurveHelper_H.GetSectPoint(qh, design_pt, eq_zero_h, ratio_extend);
            if (sect_pt == null)
            {
                return null;
            }
            if (sect_pt.X > qh.MaxX * ratio_extend)
            {
                return null;
            }
 
            return sect_pt;
        }
 
        /// <summary>
        /// 计算装置曲线与流量扬程曲线的交点
        /// </summary>
        /// <param name="CurveExpressQH"></param>
        /// <param name="DesignPoint"></param>
        /// <param name="eq_zero_h"></param>
        /// <param name="ratio_extend"></param>
        /// <returns></returns>
        static public Yw.Geometry.Point2d GetSectPoint(
           Yw.Geometry.CubicSpline2d CurveExpressQH,
           Yw.Geometry.Point2d DesignPoint,
           double eq_zero_h,
           double ratio_extend)
        {//有一种情况: 用包络法有交点(在最末尾),但用装置曲线绘制时,与装置曲线没有交点,因为交点已超过曲线最大值
 
            var sect_pt = Yw.Geometry.ParabolaCurveHelper_H.GetSectPoint(CurveExpressQH, DesignPoint, eq_zero_h, ratio_extend);
            if (sect_pt == null)
            {
                return null;
            }
            if (sect_pt.X > CurveExpressQH.MaxX * ratio_extend)
            {
                return null;
            }
 
            return sect_pt;
        }
 
    }
}