ningshuxia
2022-10-31 0171d347fec140d31db39ab5d76d51eebac472c2
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace IStation.Dto.DispatchAna
{
    /// <summary>
    /// 简单计算
    /// </summary>
    public class CalcBySimple_Request
    {
        /// <summary>
        /// 机泵运行状态
        /// </summary>
        public class RunStatus
        {
            /// <summary>
            /// 
            /// </summary>
            public long MachineID { get; set; } = 0;
            /// <summary>
            /// -1 表示任意  0 关机 1开机
            /// </summary>
            public int Status { get; set; } = -1;
        }
 
        /// <summary>
        /// 
        /// </summary>
        public long CorpID { get; set; }
 
        /// <summary>
        /// 
        /// </summary>
        public long StationID { get; set; }
 
        /// <summary>
        /// 管路参数
        /// </summary>
        public class PipeParas 
        {
            /// <summary>
            /// 
            /// </summary>
            public double TargetFlow { get; set; }
            /// <summary>
            ///  如果是压力就是出口压力
            /// </summary>
            public double TargetPress { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string TargetFlowMinQ { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string TargetFlowMaxQ { get; set; }
        }
 
        /// <summary>
        /// 阀门参数
        /// </summary>
        public class ValveParas
        {
            /// <summary>
            /// 
            /// </summary>
            public string Name { get; set; }
            /// <summary>
            /// /
            /// </summary>
            public int Status { get; set; }
        }
      
        /// <summary>
        /// 水位参数 
        /// </summary>
        public List<double> WaterLevelList { get; set; }
 
        /// <summary>
        /// 管路参数
        /// </summary>
        public List<PipeParas> PipeList { get; set; }
 
        /// <summary>
        /// 阀门参数
        /// </summary>
        public List<ValveParas> ValveList { get; set; }
 
        /// <summary>
        /// 机泵运行参数
        /// </summary>
        public List<RunStatus> RunStatusList { get; set; }
 
        /// <summary>
        /// 排序方法: 0 功率 1 流量间隔
        /// </summary>
        public int SortType { get; set; }
 
        /// <summary>
        /// 压力值类型 0:表示压力 1:表示扬程
        /// </summary>
        public int PressValueType { get; set; }
 
        /// <summary>
        /// 能效分析记录
        /// </summary>
        public StationEtaAnaRecord EtaAnaRecord { get; set; }
 
        /// <summary>
        /// 构建成复合参数
        /// </summary>
        /// <param name="error_info"></param>
        /// <returns></returns>
        public IStation.Calculation.DispatchAna.Model.RequestParasComplex BuildRequestComplex(out string error_info)
        {
            error_info = null;
            var complex_request_paras = new  Calculation.DispatchAna.Model.RequestParasComplex();
            complex_request_paras.InletPipePara = new List<Calculation.DispatchAna.Model.InletPipePara>();
            complex_request_paras.CorpID = this.CorpID;
            complex_request_paras.StationID = this.StationID;
 
            if (this.PressValueType == 1)
            {//1:表示扬程 
                complex_request_paras.PressValueType = Calculation.DispatchAna.Model.RequestParasComplex.ePressValueType.扬程;
 
                complex_request_paras.InletPipePara = new List<Calculation.DispatchAna.Model.InletPipePara>();
                complex_request_paras.InletPipePara.Add(new Calculation.DispatchAna.Model.InletPipePara(0));
            }
            else
            {//压力
                complex_request_paras.PressValueType = Calculation.DispatchAna.Model.RequestParasComplex.ePressValueType.压力;
 
                if (WaterLevelList != null && WaterLevelList.Count > 0)
                {
                    complex_request_paras.InletPipePara = new List<Calculation.DispatchAna.Model.InletPipePara>();
                    foreach (var wl in WaterLevelList)
                    {
                        complex_request_paras.InletPipePara.Add(new Calculation.DispatchAna.Model.InletPipePara(wl));
                    }
                }             
            }
 
            if (this.PipeList != null&& this.PipeList.Count > 0)
            {
                complex_request_paras.OutletPipePara = new List<Calculation.DispatchAna.Model.OutletPipePara>();
                foreach (var pipe in this.PipeList)
                {
                    var pipe_model = new Calculation.DispatchAna.Model.OutletPipePara();
                    pipe_model.InitialFlowInfo(pipe.TargetFlow, pipe.TargetFlowMinQ, pipe.TargetFlowMaxQ);
                    pipe_model.TargetPress = pipe.TargetPress;
                    complex_request_paras.OutletPipePara.Add(pipe_model);
                }
            }
      
            if (this.ValveList != null && this.ValveList.Count > 0)
            {
                complex_request_paras.ValvePara = new List<Calculation.DispatchAna.Model.ValvePara>(); 
                foreach (var valve in this.ValveList)
                {
                    complex_request_paras.ValvePara.Add(
                        new Calculation.DispatchAna.Model.ValvePara() { Name = valve.Name, OpenStatus = valve.Status });
                }
            }
 
            complex_request_paras.SchemeSortType = (Calculation.DispatchAna.Model.eAnaSchemeSortType)this.SortType;
            return complex_request_paras;
        }
    
    
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IStation.Calculation.DispatchAna.Model.MachineRunPara BuildMachineRunPara(out string error_info)
        {
            error_info = null;
            List<IStation.Calculation.DispatchAna.Model.MachineRunFilter> machine_run_filter_list = null;
            if (this.RunStatusList == null)
            {
                // IStation.LogHelper.Info("RunStatusList none");
            }
            else if (this.RunStatusList.Count() == 0)
            {
                // IStation.LogHelper.Info("RunStatusList Count==0");
            }
            else //if (request.Setting.OpenStatus != null && request.Setting.OpenStatus.Count > 0)
            {
                machine_run_filter_list = new List<IStation.Calculation.DispatchAna.Model.MachineRunFilter>();
                foreach (var d in this.RunStatusList)
                {
                    var binding_list = new Service.PipeLineBinding().GetByPipeLineID(this.CorpID, d.MachineID);
                    machine_run_filter_list.Add(new IStation.Calculation.DispatchAna.Model.MachineRunFilter()
                    {
                        MachineID = binding_list.First().ID,
                        RunStatus = d.Status,
                        MaxFlow = -1
                    });
                }
            }
            return new IStation.Calculation.DispatchAna.Model.MachineRunPara()
            {
                MachineRunFilter = machine_run_filter_list
            }; 
        }
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="error_info"></param>
        /// <returns></returns>
        public IStation.Calculation.DispatchAna.Model.EtaAnaRecord4Station BuildEtaAnaRecord(out string error_info)
        {
            error_info = null;
            if (EtaAnaRecord == null)
                return null;
    
            return EtaAnaRecord.Build(out error_info);
        }
    }
 
 
    /// <summary>
    /// 查看详细图表
    /// </summary>
    internal class CurveItem
    {
        public int Type { get; set; }//0表示单泵曲线 1表示并联曲线
        public string Name { get; set; }
        public List<List<double>> PointQH { get; set; }
        public List<List<double>> PointQP { get; set; }
    }
}