Shuxia Ning
2024-12-19 b0c978129ba55cf81e8470b6c9326745a5dbc7d1
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Eventech.Model
{
    public class CombineCurveList : List<CombineCurve>, ICloneable
    {//List都用|分开
        #region 构造函数
        public CombineCurveList()
        {
        }
        public CombineCurveList(string strExpressList, int pointNum = 8)
        {//LIST都用|分开
            if (string.IsNullOrEmpty(strExpressList))
                return;
 
            string[] strExpresses = strExpressList.Split(new string[] { "|" }, StringSplitOptions.None);
            if (strExpresses == null || strExpresses.Count() == 0)
                return;
 
            foreach (var strExpress in strExpresses)
            {
                var express = new Eventech.Model.CombineCurve(strExpress, pointNum);
                if (!express.IsNull)
                    Add(express);
            }
        }
 
 
 
        public CombineCurveList(CombineCurveList rhs)
        {
            if (rhs == null)
                return;
 
            foreach (CombineCurve item in rhs)
            {
                this.Add(item.Clone());
            }
        }
        public CombineCurveList(IEnumerable<CombineCurve> rhs)
        {
            if (rhs == null)
                return;
 
            foreach (CombineCurve item in rhs)
            {
                this.Add(item.Clone());
            }
        }
        public CombineCurveList(IEnumerable<ThroughParaCurve> rhs)
        {
            if (rhs == null)
                return;
 
            foreach (ThroughParaCurve item in rhs)
            {
                this.Add(new CombineCurve(item));
            }
        }
        #endregion
 
         //50HZ->60HZ
        public CombineCurveList From50to60HZ( )
        {
            return SimuBySpeed(1.2);
        }
        //相似换算(speed_ratio = 新的转速 除以 老的转速)
        public CombineCurveList SimuBySpeed(double speed_ratio)
        {
            CombineCurveList C60 = new CombineCurveList();
            foreach (CombineCurve c50 in this)
            {
                C60.Add(c50.SimuBySpeed(  speed_ratio));
            }
 
            return C60;
        }
 
        public string ToDsString()
        {
            return ToDsString(this);
        }
        public static string ToDsString(CombineCurveList express)
        {//LIST都用|分开
            if (express == null || express.Count == 0)
                return null;
 
            var strs = from x in express select x.ToDsString();
            return string.Join("|", strs);
        }
 
        public static CombineCurveList ToParameter(string strStore)
        {
            if (string.IsNullOrEmpty(strStore))
                return null;
            return new CombineCurveList(strStore);
        }
 
        object ICloneable.Clone()
        {
            return this.Clone();
        }
 
        public CombineCurveList Clone()
        {
            return new CombineCurveList(this);
        }
 
        //获取最大最小值
        public void GetBoundaryPoint(out double boudary_min_x, out double boudary_max_x, out double boudary_min_y, out double boudary_max_y)
        {
            boudary_min_x = double.MaxValue;
            boudary_max_x = double.MinValue;
            boudary_min_y = double.MaxValue;
            boudary_max_y = double.MinValue;
 
            foreach (var curve in this)
            {
                boudary_min_x = Math.Min(boudary_min_x, (from x in curve.PointInfo select x.X).Min());
                boudary_max_x = Math.Max(boudary_max_x, (from x in curve.PointInfo select x.X).Max());
                boudary_min_y = Math.Min(boudary_min_y, (from x in curve.PointInfo select x.Y).Min());
                boudary_max_y = Math.Max(boudary_min_y, (from x in curve.PointInfo select x.Y).Max());
            }
 
        }
 
        public Boundary GetBoundaryPoint( )
        {
            double boudary_min_x = double.MaxValue;
            double boudary_max_x = double.MinValue;
            double boudary_min_y = double.MaxValue;
            double boudary_max_y = double.MinValue;
 
            foreach (var curve in this)
            {
                boudary_min_x = Math.Min(boudary_min_x, (from x in curve.PointInfo select x.X).Min());
                boudary_max_x = Math.Max(boudary_max_x, (from x in curve.PointInfo select x.X).Max());
                boudary_min_y = Math.Min(boudary_min_y, (from x in curve.PointInfo select x.Y).Min());
                boudary_max_y = Math.Max(boudary_min_y, (from x in curve.PointInfo select x.Y).Max());
            }
            return new Boundary(boudary_min_x, boudary_max_x, boudary_min_y, boudary_max_y);
        }
    }
}