lixiaojun
2022-08-03 aa5aa380cb4e3f63b2e98c5e686b69becefce332
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Model
{
    /// <summary>
    /// 
    /// </summary>
    public class EtaBasicRealRecord
    {
        /// <summary>
        /// 
        /// </summary>
        public EtaBasicRealRecord() { }
 
        /// <summary>
        /// 
        /// </summary>
        public EtaBasicRealRecord(EtaBasicRealRecord rhs)
        {
            this.CorpID = rhs.CorpID;
            this.ObjectType = rhs.ObjectType;
            this.ObjectID = rhs.ObjectID;
            this.DataTime = rhs.DataTime;
            this.Duration = rhs.Duration;
            this.Qa = rhs.Qa;
            this.Ha = rhs.Ha;
            this.Pa = rhs.Pa;
            this.Ea = rhs.Ea;
            this.WPa = rhs.WPa;
            this.UWPa = rhs.UWPa;
            this.AnalyStatus = rhs.AnalyStatus;
            this.AnalyInfo = rhs.AnalyInfo;
        }
 
        /// <summary>
        /// 复制分析参数
        /// </summary>
        /// <param name="rhs"></param>
        public void CopyAnaPara(EtaBasicRealRecord rhs)
        {
            if (rhs == null)
                return;
            this.Qa = rhs.Qa;
            this.Ha = rhs.Ha;
            this.Pa = rhs.Pa;
            this.Ea = rhs.Ea;
            this.WPa = rhs.WPa;
            this.UWPa = rhs.UWPa;
            this.AnalyStatus = rhs.AnalyStatus;
            this.AnalyInfo = rhs.AnalyInfo;
        }
 
 
        /// <summary>
        /// 客户标识
        /// </summary>    
        public long CorpID { get; set; }
 
        /// <summary>
        /// 对象类型
        /// </summary>    
        public string ObjectType { get; set; }
 
        /// <summary>
        /// 对象标识
        /// </summary>    
        public long ObjectID { get; set; }
 
        /// <summary>
        /// 数据时间
        /// </summary>    
        public DateTime DataTime { get; set; }
 
        /// <summary>
        /// 间隔
        /// </summary>    
        public int Duration { get; set; }
 
        /// <summary>
        /// 分析瞬时流量
        /// </summary>    
        public double? Qa { get; set; }
 
        /// <summary>
        /// 分析扬程
        /// </summary>    
        public double? Ha { get; set; }
 
        /// <summary>
        /// 分析功率
        /// </summary>    
        public double? Pa { get; set; }
 
        /// <summary>
        /// 分析效率
        /// </summary>    
        public double? Ea { get; set; }
 
        /// <summary>
        /// 分析千吨能耗
        /// </summary>    
        public double? WPa { get; set; }
 
        /// <summary>
        /// 分析单位能耗
        /// </summary>    
        public double? UWPa { get; set; }
 
        /// <summary>
        /// 分析状态
        /// </summary>    
        public Eta.eAnalyStatus AnalyStatus { get; set; }
 
        /// <summary>
        /// 分析信息
        /// </summary>    
        public string AnalyInfo { get; set; }
 
        #region AnalyInfo 
        /// <summary>
        /// 添加状态
        /// </summary>
        /// <param name="tag"></param>
        public void PutAnalyInfo(string tag)
        {
            if (string.IsNullOrEmpty(AnalyInfo))
            {
                AnalyInfo = string.Format("V1|{0}:", tag);
            }
            else
            {
                AnalyInfo = string.Format("{0}|{1}:", AnalyInfo, tag);
            }
        }
        /// <summary>
        /// 添加AnalyInfo标识
        /// </summary>
        /// <param name="tag">标识</param>
        /// <param name="more">更多信息</param>
        public void PutAnalyInfo(string tag, string more)
        {
            if (string.IsNullOrEmpty(AnalyInfo))
            {
                if (string.IsNullOrEmpty(more))
                {
                    AnalyInfo = string.Format("V1|{0}:", tag);
                }
                else
                {
                    AnalyInfo = string.Format("V1|{0}:{1}", tag, more);
                }
            }
            else
            {
                if (string.IsNullOrEmpty(more))
                {
                    AnalyInfo = string.Format("{0}|{1}:", AnalyInfo, tag);
                }
                else
                {
                    AnalyInfo = string.Format("{0}|{1}:{2}", AnalyInfo, tag, more);
                }
            }
        }
        /// <summary>
        /// 添加AnalyInfo标识
        /// </summary>
        /// <param name="tag">标识</param> 
        public void RemoveAnalyInfo(string tag)
        {
            if (string.IsNullOrEmpty(AnalyInfo))
            {
                return;
            }
            var sss = AnalyInfo.Split('|').ToList();
 
            for (int i = 0; i < sss.Count(); i++)
            {
                if (sss[i].StartsWith(tag))
                {
                    sss.RemoveAt(i);
                    AnalyInfo = string.Join("|", sss);
                    if (AnalyInfo == "V1")
                    {
                        AnalyInfo = null;
                    }
                    return;
                }
            }
 
 
        }
 
        /// <summary>
        /// 有分析异常
        /// </summary>
        /// <param name="tag"></param>
        /// <returns></returns>
        public bool IsHaveAnaTag(string tag)
        {
            if (string.IsNullOrEmpty(AnalyInfo))
            {
                return false;
            }
 
            return AnalyInfo.Contains("|" + tag);
        }
 
        /// <summary>
        /// 运行状态发生异常的标识
        /// </summary>
        public static string InfoTag_RU = "RU";
        /// <summary>
        /// 频率发生异常的标识
        /// </summary>
        public static string InfoTag_HZ = "HZ";
        /// <summary>
        /// 流量发生异常的标识
        /// </summary>
        public static string InfoTag_Qa = "Qa";
        /// <summary>
        /// 扬程发生异常的标识
        /// </summary>
        public static string InfoTag_Ha = "Ha";
        /// <summary>
        /// 进口压力发生异常的标识
        /// </summary>
        public static string InfoTag_P1 = "P1";
        /// <summary>
        /// 出口压力发生异常的标识
        /// </summary>
        public static string InfoTag_P2 = "P2";
        /// <summary>
        /// 功率发生异常的标识
        /// </summary>
        public static string InfoTag_Pa = "Pa";
        /// <summary>
        /// 效率发生异常的标识
        /// </summary>
        public static string InfoTag_Ea = "Ea";
        /// <summary>
        /// 电流发生异常的标识
        /// </summary>
        public static string InfoTag_Ia = "Ia";
        /// <summary>
        /// 曲线发生异常的标识
        /// </summary>
        public static string InfoTag_Curve = "Cu";
        #endregion
 
 
 
 
        #region 计算
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="mpa"></param>
        /// <returns></returns>
        public static double MPa2M(double mpa)
        {
            return mpa * 1000 / 9.81;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Q"></param>
        /// <param name="H"></param>
        /// <param name="P"></param>
        /// <param name="midu"></param>
        /// <param name="gavity"></param>
        /// <returns></returns>
        public static double Calc_Eta(double Q, double H, double P, double midu, double gavity)
        {
            P = P * 1000;//此处 1000 是 kw换成w 
            Q = Q / 3600;//此处 3600 是 小时换成秒
            double E = 0;
            if (P < 0.1)
                E = 0;
            else
                E = midu * gavity * Q * H / P;
            return Math.Round(E * 100, 2);//效率用百分数
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Q"></param>
        /// <param name="H"></param>
        /// <param name="P"></param>
        /// <returns></returns>
        public static double Calc_Eta(double Q, double H, double P)
        {
            double midu = 1000;
            double gavity = 9.81;
            P = P * 1000;//此处 1000 是 kw换成w 
            Q = Q / 3600;//此处 3600 是 小时换成秒
            double E = 0;
            if (P < 0.1)
                E = 0;
            else
                E = midu * gavity * Q * H / P;
            return Math.Round(E * 100, 2);//效率用百分数
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool Calcu_WP()
        {
            if (this.Qa == null || this.Qa < 0.1)
                return false;
            if (this.Pa == null || this.Pa < 0.1)
                return false;
 
            this.WPa = Math.Round(this.Pa.Value / this.Qa.Value * 1000f, 3);
            return true;
        }
 
        /// <summary>
        /// 单位水耗 千吨水
        /// </summary>
        /// <returns></returns>
        public bool Calcu_UWP()
        {
            if (this.Qa == null || this.Qa < 0.1)
                return false;
            if (this.Pa == null || this.Pa < 0.1)
                return false;
            if (this.Ha == null || this.Ha < 0.1)
                return false;
            this.UWPa = Math.Round(this.Pa.Value / this.Qa.Value / this.Ha.Value * 1000f, 4);
            return true;
        }
        #endregion
    }
}