ningshuxia
2023-06-27 d5a533d045422407c1b7edfdde9fd19740e478d1
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
 
namespace IStation.Calculation.DispatchAna
{
    /// <summary>
    /// 常规
    /// </summary> 
    internal class Calculator4StationGeneral : CalculatorBase 
    {
        /// <summary>
        /// 获取当前调度信息
        /// </summary>
        /// <param name="CorpID"></param>
        /// <param name="StationID"></param>
        /// <param name="error_info"></param>
        /// <returns></returns>
        public IStation.Calculation.DispatchAna.Model.CurrentRecordBundle GetCurrentRecord(
            long CorpID, 
            long StationID, 
            out string error_info)
        {
            error_info = null;
            return null;
        }
 
 
 
 
   
        /// <summary>
        /// 计算(最优)
        /// </summary>
        /// <param name="complex_request_paras">需求参数</param>
        /// <param name="machine_run_status"></param>
        /// <param name="error_info">错误信息</param>
        /// <returns></returns>
        public override List<Calculation.DispatchAna.Model.AnaScheme> CalcOptListCore(
                            IStation.Calculation.DispatchAna.Model.RequestParasComplex complex_request_paras,
                            IStation.Calculation.DispatchAna.Model.MachineRunPara machine_run_status,
                            out string error_info)
        {
            error_info = null;
            this._corpID = complex_request_paras.CorpID;
            this._stationID = complex_request_paras.StationID;
            if (complex_request_paras == null)
            {
                error_info = "ERROR 30";
                return null;
            }
            if (complex_request_paras.OutletPipePara == null || complex_request_paras.OutletPipePara.Count < 1)
            {
                error_info = "出口管路参数有误, ERROR 35";
                return null;
            }
            double target_flow = complex_request_paras.OutletPipePara[0].TargetFlow;
            if (target_flow < 10)
            {
                error_info = "流量值过低, ERROR 67";
                return null;
            }
 
            double target_press  = complex_request_paras.OutletPipePara[0].TargetPress;
            if (target_press < 0.01)
            {
                error_info = "压力值过低,ERROR 68";
                return null;
            }
 
            double water_level = 0;//水位
            if (complex_request_paras.WaterLevelPara != null && complex_request_paras.WaterLevelPara.Count > 0)
            {
                water_level = complex_request_paras.WaterLevelPara.First().Value;
            }
 
 
 
 
            List<IStation.Calculation.DispatchAna.Model.MachineDetail> allMachineList = null;
            if (!BuildMachineList( 
                out allMachineList,
                out error_info))
            {
                error_info = "机泵组无法构建,ERROR 70,错误信息:" + error_info;
                return null;
            }
 
 
            IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper calc_pipe_helper =
                new IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper();
            calc_pipe_helper.InitialParas(
                target_flow,
                water_level,
                target_press,
                complex_request_paras.OutletPipePara[0].TargetFlowRangeMin,
                complex_request_paras.OutletPipePara[0].TargetFlowRangeMax,
                allMachineList,
                machine_run_status.MachineRunFilter);
 
            return calc_pipe_helper.CalcOptList(complex_request_paras.SchemeSortType, complex_request_paras.SchemeNumber);  
        }
 
        /// <summary>
        /// 计算保持当前开机状态
        /// </summary>
        /// <param name="requesParas"></param>
        /// <param name="openMachineIdList">开泵ID</param>
        /// <param name="error_info">错误信息</param>
        /// <returns></returns>
        protected override IStation.Calculation.DispatchAna.Model.AnaScheme CalcKeepStatusCore(
                            IStation.Calculation.DispatchAna.Model.RequestParasComplex requesParas,
                            List<long> openMachineIdList,
                            out string error_info)
        {
            error_info = null;
            this._corpID = requesParas.CorpID;
            this._stationID = requesParas.StationID;
            if (requesParas == null)
            {
                error_info = "ERROR 30";
                return null;
            }
            if (openMachineIdList == null || openMachineIdList.Count == 0)
            {
                error_info = "ERROR 25";
                return null;
            }
            if (requesParas.OutletPipePara == null || requesParas.OutletPipePara.Count < 2)
            {
                error_info = "ERROR 35";
                return null;
            }
            double target_flow = requesParas.OutletPipePara[0].TargetFlow; 
            if (target_flow < 10  )
            {
                return default;
            }
 
            double target_press = requesParas.OutletPipePara[0].TargetPress;
            if (target_press < 10)
            {
                return default;
            }
 
            double water_level = 0;//水位
            if (requesParas.WaterLevelPara != null && requesParas.WaterLevelPara.Count > 0)
            {
                water_level = requesParas.WaterLevelPara.First().Value;
            }
    
            if (requesParas.ValvePara == null || requesParas.ValvePara.Count < 1)
            {
                error_info = "ERROR 135";
                return null;
            }
 
            List<IStation.Calculation.DispatchAna.Model.MachineDetail> allMachineList = null;
            if (!BuildMachineList( 
                out allMachineList,
                out error_info))
            {
                error_info = "机泵组无法构建,ERROR 70,错误信息:" + error_info;
                return null;
            }
 
            IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper calc_pipe_helper =
                new IStation.Calculation.DispatchAna.Common.DispatchAnaGeneralHelper();
            calc_pipe_helper.InitialParas(
                target_flow,
                water_level,
                target_press,
                requesParas.OutletPipePara[0].TargetFlowRangeMin,
                requesParas.OutletPipePara[0].TargetFlowRangeMax,
                allMachineList, null);
 
            return calc_pipe_helper.CalcKeepStatus(openMachineIdList);
        }
 
    }
}