ningshuxia
2022-12-01 ad494f13d2ddf31f142cf7fb908b3a6e90395a1a
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IStation.Formula;
 
namespace IStation.Model.Monitor 
{
    /// <summary>
    /// 单位能耗计算公式参数
    /// </summary>
    public class UWPCalculationFormulaParas : JsonModel<UWPCalculationFormulaParas>
    {
        /// <summary>
        /// 瞬时流量测点标识
        /// </summary>
        public long Q { get; set; }
 
        /// <summary>
        /// 有功功率测点标识
        /// </summary>
        public long P { get; set; }
 
        /// <summary>
        /// 扬程测点标识
        /// </summary>
        public long H { get; set; }
 
 
        /// <summary>
        /// 计算
        /// </summary>
        public bool Calculate(double p, double q, double h, out double uwp)
        {
            uwp = 0;
            if (q < 0.1)
                return false;
            if (h < 0.1)
                return false;
            uwp = CalcuHelper.CalculateUWP(p, q, h);
            return true;
        }
 
        /// <summary>
        /// 计算
        /// </summary>
        public bool Calculate(string p, string q, string h, out double uwp)
        {
            uwp = 0;
            if (!double.TryParse(p, out double tp))
            {
                return false;
            }
            if (!double.TryParse(q, out double tq))
            {
                return false;
            }
            if (tq < 0.1)
            {
                return false;
            }
            if (!double.TryParse(h, out double th))
            {
                return false;
            }
            if (th < 0.1)
            {
                return false;
            }
 
            uwp = CalcuHelper.CalculateUWP(tp, tq, th);
            return true;
        }
    }
}