| | |
| | | /// </summary> |
| | | /// <param name="pumps"></param> |
| | | /// <param name="flag_rpm_dic"></param> |
| | | /// <param name="flag_inlet_water_level_dict"></param> |
| | | /// <param name="flag_head_dic"></param> |
| | | /// <param name="target_flow"></param> |
| | | /// <param name="target_head"></param> |
| | |
| | | public AnaCombine GetOptAnaCombineByWorking( |
| | | List<Model.Pump> pumps, |
| | | Dictionary<int, double> flag_rpm_dic, |
| | | Dictionary<int, double> flag_inlet_water_level_dict, |
| | | Dictionary<int, double> flag_head_dic, |
| | | double target_flow, |
| | | double target_head |
| | |
| | | var curveQP = Curve.PumpCalculateHelper.CalculateSimilarQP(pump.CurveQP, pump.Nr, rpm); |
| | | |
| | | double flow = 0, head = target_head; |
| | | |
| | | if (flag_head_dic != null && flag_head_dic.ContainsKey(pump.Flag)) |
| | | { |
| | | head = flag_head_dic[pump.Flag]; |
| | | } |
| | | |
| | | if (flag_inlet_water_level_dict != null && flag_inlet_water_level_dict.ContainsKey(pump.Flag)) |
| | | { |
| | | head -= flag_inlet_water_level_dict[pump.Flag]; |
| | | } |
| | | |
| | | flow = curveQH.GetInterPointLastX(head) ?? 0; |
| | | if (flow < 0) |
| | |
| | | var fre_pump = new AnaFrePump(); |
| | | fre_pump.Flag = item.Key; |
| | | fre_pump.Flow = flow; |
| | | fre_pump.Head = target_head; |
| | | fre_pump.Head = head; |
| | | fre_pump.Power = curveQP.GetFitPointY(flow); |
| | | fre_pump.Efficiency = Curve.PumpCalculateHelper.CalculateE(fre_pump.Flow, fre_pump.Head, fre_pump.Power); |
| | | fre_pump.Frequency = rpm; |
| | | fre_pump.Speed = (double)rpm / 50 * pump.Nr; |
| | | fre_pump.Frequency = rpm / pump.Nr * 50; |
| | | fre_pump.Speed = rpm; |
| | | |
| | | |
| | | total_flow += flow; |
| | |
| | | return combine; |
| | | } |
| | | |
| | | private bool _debug_init = false; |
| | | private List<AvgStatisticsS1> _debug_avg1_list = null; |
| | | private List<AvgStatisticsS2> _debug_avg2_list = null; |
| | | |
| | | |
| | | private int _station = 1; |
| | | private Dictionary<int, double> _correction_factor_dict_diff1 = null; |
| | | private Dictionary<int, double> _correction_factor_dict_diff2 = null; |
| | | |
| | | private Dictionary<int, double> _correction_factor_dict = null; |
| | | |
| | | /// <summary> |
| | | /// 初始化组合修正系数 |
| | | /// </summary> |
| | | /// <param name="debug_avg1_list"></param> |
| | | /// <param name="debug_avg2_list"></param> |
| | | public void InitCombineCorrectionFactor(List<AvgStatisticsS1> debug_avg1_list, List<AvgStatisticsS2> debug_avg2_list) |
| | | /// <param name="correction_factor_dict"></param> |
| | | public void InitCorrectionFactorDict(Dictionary<int, double> correction_factor_dict) |
| | | { |
| | | _debug_avg1_list = debug_avg1_list; |
| | | _debug_avg2_list = debug_avg2_list; |
| | | _correction_factor_dict = correction_factor_dict; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化组合修正系数 |
| | | /// </summary> |
| | | /// <param name="correction_factor_dict_diff1"></param> |
| | | /// <param name="correction_factor_dict_diff2"></param> |
| | | public void InitCorrectionFactorDict(Dictionary<int, double> correction_factor_dict_diff1, Dictionary<int, double> correction_factor_dict_diff2) |
| | | { |
| | | _correction_factor_dict_diff1 = correction_factor_dict_diff1; |
| | | _correction_factor_dict_diff2 = correction_factor_dict_diff2; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化泵站 |
| | | /// </summary> |
| | | public void InitStation(int station) |
| | | { |
| | | _station = station; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取组合修正系数 |
| | | /// </summary> |
| | | /// <param name="flags"></param> |
| | | /// <returns></returns> |
| | | private Dictionary<int, double> GetCombineCorrectionFactor_update_ing(IEnumerable<int> flags) |
| | | { |
| | | var correction_factor_dict = new Dictionary<int, double>(); |
| | | var flags_str = IntListHelper.ToString(flags); |
| | | var avg1 = _debug_avg1_list?.Find(x => x.RunFlags == flags_str); |
| | | if (avg1 != null) |
| | | { |
| | | correction_factor_dict.Add(GlobalHelper.Flag11, avg1.Pump11Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag12, avg1.Pump12Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag13, avg1.Pump13Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag14, avg1.Pump14Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag15, avg1.Pump15Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag16, avg1.Pump16Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag17, avg1.Pump17Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag18, avg1.Pump18Pd ?? 0); |
| | | |
| | | if (_correction_factor_dict_diff1 != null) |
| | | { |
| | | foreach (var item in _correction_factor_dict_diff1) |
| | | { |
| | | correction_factor_dict[item.Key] += item.Value; |
| | | } |
| | | } |
| | | return correction_factor_dict; |
| | | } |
| | | |
| | | var avg2 = _debug_avg2_list?.Find(x => x.RunFlags == flags_str); |
| | | if (avg2 != null) |
| | | { |
| | | correction_factor_dict.Add(GlobalHelper.Flag21, avg2.Pump21Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag22, avg2.Pump22Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag23, avg2.Pump23Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag24, avg2.Pump24Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag25, avg2.Pump25Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag26, avg2.Pump26Pd ?? 0); |
| | | correction_factor_dict.Add(GlobalHelper.Flag27, avg2.Pump27Pd ?? 0); |
| | | |
| | | if (_correction_factor_dict_diff2 != null) |
| | | { |
| | | foreach (var item in _correction_factor_dict_diff2) |
| | | { |
| | | correction_factor_dict[item.Key] += item.Value; |
| | | } |
| | | } |
| | | return correction_factor_dict; |
| | | } |
| | | |
| | | if (!correction_factor_dict.Any()) |
| | | { |
| | | Console.WriteLine(flags_str); |
| | | if (_station == 1) |
| | | { |
| | | foreach (var item in GlobalHelper.Station1FlagList) |
| | | { |
| | | correction_factor_dict.Add(item, 0); |
| | | } |
| | | |
| | | if (_correction_factor_dict_diff1 != null) |
| | | { |
| | | foreach (var item in _correction_factor_dict_diff1) |
| | | { |
| | | correction_factor_dict[item.Key] += item.Value; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | foreach (var item in GlobalHelper.Station2FlagList) |
| | | { |
| | | correction_factor_dict.Add(item, 0); |
| | | } |
| | | |
| | | if (_correction_factor_dict_diff2 != null) |
| | | { |
| | | foreach (var item in _correction_factor_dict_diff2) |
| | | { |
| | | correction_factor_dict[item.Key] += item.Value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return correction_factor_dict; |
| | | } |
| | | |
| | | |
| | | // private bool _debug_init = false; |
| | | // private List<AvgStatisticsS1> _debug_avg1_list = null; |
| | | // private List<AvgStatisticsS2> _debug_avg2_list = null; |
| | | |
| | | // /// <summary> |
| | | // /// 获取组合修正系数 |
| | | // /// </summary> |
| | | // /// <param name="flags"></param> |
| | | // /// <returns></returns> |
| | | // private Dictionary<int, double> GetCombineCorrectionFactor(IEnumerable<int> flags) |
| | | // { |
| | | // var correction_factor_dict = new Dictionary<int, double>(); |
| | | //#if DEBUG |
| | | // if (!_debug_init) |
| | | // { |
| | | // var avg1_json = File.ReadAllText("D:\\AvgStatisticsS1ViewModelList.json"); |
| | | // _debug_avg1_list = JsonHelper.Json2Object<List<AvgStatisticsS1>>(avg1_json); |
| | | // if (_debug_avg1_list != null) |
| | | // { |
| | | // _debug_avg1_list.ForEach(x => x.Round()); |
| | | // } |
| | | |
| | | // var avg2_json = File.ReadAllText("D:\\AvgStatisticsS2ViewModelList.json"); |
| | | // _debug_avg2_list = JsonHelper.Json2Object<List<AvgStatisticsS2>>(avg2_json); |
| | | // if (_debug_avg2_list != null) |
| | | // { |
| | | // _debug_avg2_list.ForEach(x => x.Round()); |
| | | // } |
| | | // _debug_init = true; |
| | | // } |
| | | |
| | | // var flags_str = IntListHelper.ToString(flags); |
| | | |
| | | // var avg1 = _debug_avg1_list?.Find(x => x.RunFlags == flags_str); |
| | | // if (avg1 != null) |
| | | // { |
| | | // correction_factor_dict.Add(GlobalHelper.Flag11, avg1.Pump11Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag12, avg1.Pump12Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag13, avg1.Pump13Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag14, avg1.Pump14Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag15, avg1.Pump15Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag16, avg1.Pump16Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag17, avg1.Pump17Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag18, avg1.Pump18Pd ?? 0); |
| | | |
| | | |
| | | // return correction_factor_dict; |
| | | // } |
| | | |
| | | // var avg2 = _debug_avg2_list?.Find(x => x.RunFlags == flags_str); |
| | | // if (avg2 != null) |
| | | // { |
| | | // correction_factor_dict.Add(GlobalHelper.Flag21, avg2.Pump21Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag22, avg2.Pump22Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag23, avg2.Pump23Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag24, avg2.Pump24Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag25, avg2.Pump25Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag26, avg2.Pump26Pd ?? 0); |
| | | // correction_factor_dict.Add(GlobalHelper.Flag27, avg2.Pump27Pd ?? 0); |
| | | |
| | | // return correction_factor_dict; |
| | | // } |
| | | //#else |
| | | // foreach (var flag in flags) |
| | | // { |
| | | // double factor = 0; |
| | | // //factor += r.NextDouble(); |
| | | // correction_factor_dict.Add(flag, factor); |
| | | // } |
| | | //#endif |
| | | // return correction_factor_dict; |
| | | // } |
| | | |
| | | /// <summary> |
| | | /// 获取组合修正系数 |
| | |
| | | /// <returns></returns> |
| | | private Dictionary<int, double> GetCombineCorrectionFactor(IEnumerable<int> flags) |
| | | { |
| | | if (_correction_factor_dict != null && _correction_factor_dict.Any()) |
| | | { |
| | | var fac_flags = _correction_factor_dict.Keys; |
| | | if (fac_flags.SequenceEqual(flags)) |
| | | { |
| | | return _correction_factor_dict; |
| | | } |
| | | } |
| | | |
| | | var correction_factor_dict = new Dictionary<int, double>(); |
| | | var r = new Random(0); |
| | | foreach (var flag in flags) |