ningshuxia
2025-03-28 94ebf14787ea1c67b6a6139a2b19e3693b809625
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
using System.Collections.Generic;
using System.Linq;
 
 
namespace PBS.WinFrmUI.Hydro.Dispatch
{
    /// <summary>
    /// 常规
    /// </summary> 
    public class Calculator_OptAna_General : CalculatorBase
    {
        /// <summary>
        /// 
        /// </summary>
        protected List<Model.MachineDetailEx> allMachineList = null;
 
        #region 计算 最优方案
  
        public List<Dispatch.Model.AnaScheme> CalcSchemes(
              List<SimuPumpViewModel> simuCalcPumps,
            Model.RequestParasComplex complex_request_paras, 
            Model.MachineRunPara machine_run_status,
            out string error_info)
        {
 
            return CalcSchemes扬程(simuCalcPumps, complex_request_paras, machine_run_status, out error_info);
        }
 
        protected List<Dispatch.Model.AnaScheme> CalcSchemes扬程(
            List<SimuPumpViewModel> simuCalcPumps,
            Model.RequestParasComplex complex_request_paras,
            Model.MachineRunPara machine_run_status,
            out string error_info)
        {
            error_info = null;
            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 < 0.01)
            {
                error_info = "流量值过低, ERROR 67";
                return null;
            }
 
            double target_head = complex_request_paras.OutletPipePara[0].TargetPress;
            if (target_head < 0.01)
            {
                error_info = "压力值过低,ERROR 68";
                return null;
            }
 
 
 
 
 
 
            if (allMachineList == null)
            {
                if (!BuildMachineList(
                    simuCalcPumps,
                    out allMachineList,
                    out error_info))
                {
                    error_info = "机泵组无法构建,ERROR 70,错误信息:" + error_info;
                    return null;
                }
 
            }
            if (allMachineList != null && allMachineList.Any())
            {
                if (machine_run_status != null && machine_run_status.MachineRunFilter != null && machine_run_status.MachineRunFilter.Any())
                {
                    foreach (var machine in allMachineList)
                    {
                        var runStatus = machine_run_status.MachineRunFilter.Find(x => x.MachineID == machine.MachineID);
                        if (runStatus != null)
                        {
                            machine.Percentage = runStatus.Percentage;
                        }
 
                        machine.IsFrequency = runStatus.IsFrequency;
                    }
                }
            }
 
 
            Common.DispatchAnaGeneralHelper扬程 calc_pipe_helper =
                new Common.DispatchAnaGeneralHelper扬程();
            calc_pipe_helper.InitialParas(
                target_flow,
                target_head,
                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);
        }
        #endregion
 
 
 
 
    }
}