ningshuxia
2025-04-22 1519533649b43337d214523f7cd075edf237b3f7
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
using System.Collections.Generic;
using System.Linq;
 
namespace IStation.Dispatch
{
    /// <summary>
    /// 
    /// </summary>
    public class CalculatorBase
    {
        /// <summary>
        /// 泵站ID
        /// </summary>
        protected long _stationId = 0;
 
 
        /// <summary>
        /// 初始化机泵列表
        /// </summary>  
        protected bool BuildMachineList(out List<Model.MachineDetail> machines, out string errInfo)
        {
            machines = null;
            errInfo = null;
            if (_stationId <= 0)
            {
                errInfo = "_stationID未赋值";
                return false;
            }
 
            var bllProduct = new BLL.Equipment();
            var bllCurve = new BLL.PumpCurve();
 
            //获取机泵列表
            var enginePumps = bllProduct.GetEnginePumpListByBelongTypeAndBelongID(IStation.ObjectType.Station, _stationId);
 
            if (enginePumps == null || enginePumps.Count() == 0)
            {
                errInfo = "未配置机泵";
                return false;
            }
            machines = new List<Model.MachineDetail>();
            foreach (var engine in enginePumps)
            {
                var pump = bllProduct.GetChildPumpByEnginePumpID(engine.ID);
                if (pump == null)
                {
                    errInfo = string.Format("机泵ID:{0},未配备泵信息", engine.ID);
                    return false;
                }
 
 
                var workCurve = bllCurve.GetDefaultWorkingByPumpID(pump.ID);
                if (workCurve == null)
                {
                    errInfo = string.Format("机泵ID:{0},泵{1},未配备泵曲线信息", engine.ID, pump.ID);
                    return false;
                }
                if (workCurve.CurveInfo == null)
                {
                    errInfo = string.Format("机泵ID:{0},泵{1},未配备泵曲线信息", engine.ID, pump.ID);
                    return false;
                }
                var machineDetail = new Model.MachineDetail(engine, pump, workCurve);
                machines.Add(machineDetail);
            }
 
            return true;
        }
 
 
        #region 计算能耗
 
        /// <summary>
        /// 计算千吨能耗
        /// </summary>
        /// <param name="power">功率kW</param>
        /// <param name="flow">瞬时流量m³/h</param>
        /// <returns>kW·h/km³</returns>
        public static double CalculateWP(double power, double flow)
        {
            if (flow < 0.1)
                return 0;
            return power / flow * 1000;
        }
 
        /// <summary>
        /// 计算单位能耗
        /// </summary>
        /// <param name="p">功率kW</param>
        /// <param name="q">瞬时流量m³/h</param>
        /// <param name="h">扬程m</param>
        /// <returns>kW·h/km³</returns>
        public static double CalculateUWP(double p, double q, double h)
        {
            if (q < 0.1)
                return default;
            if (h < 0.1)
                return default;
            return p / q / h * 1000;
        }
 
        #endregion
 
    }
}