using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
|
namespace IStation.WinFrmUI
|
{
|
/// <summary>
|
/// 导出 分析系数
|
/// </summary>
|
public partial class AnalysisHelper
|
{
|
#region Model
|
|
public class ScadaDiffViewModel
|
{
|
public DateTime Time { get; set; }
|
public int Flag { get; set; }
|
public double Rpm { get; set; }
|
public double Hz { get; set; }
|
public double Hz0 { get; set; }
|
public double Flow { get; set; }
|
public double Head { get; set; }
|
public double CurveHead { get; set; }
|
public double HeadDiff { get; set; }
|
public double CorrectCurveHead { get; set; }
|
public double CorrectHeadDiff { get; set; }
|
}
|
|
public class ModelDiffViewMdoel
|
{
|
public string Time { get; set; }
|
public string MonitorID { get; set; }
|
public string ModelID { get; set; }
|
public double ModelValue { get; set; }
|
public double MonitorValue { get; set; }
|
public double DiffVlaue { get; set; }
|
public int? Flag { get; set; }
|
public double? Hz { get; set; }
|
public double? Hz0 { get; set; }
|
}
|
|
public class AnalysisFactorDto
|
{
|
/// <summary>
|
/// 泵站
|
/// </summary>
|
public int Station { get; set; }
|
|
/// <summary>
|
/// 泵标志
|
/// </summary>
|
public int Flag { get; set; }
|
|
/// <summary>
|
/// 频率
|
/// </summary>
|
public double Hz { get; set; }
|
|
/// <summary>
|
/// 扬程标准差
|
/// </summary>
|
public double? HeadSTDP { get; set; }
|
|
/// <summary>
|
/// 扬程偏差
|
/// </summary>
|
public double? HeadDeviation { get; set; }
|
|
/// <summary>
|
/// 准确度
|
/// </summary>
|
public double Accuracy { get; set; }
|
|
/// <summary>
|
/// 数量
|
/// </summary>
|
public int Count { get; set; }
|
|
}
|
|
public class AnalysisDeviationDto
|
{
|
/// <summary>
|
/// 泵站
|
/// </summary>
|
public int Station { get; set; }
|
|
/// <summary>
|
/// 运行组合
|
/// </summary>
|
public List<int> RunFlags { get; set; }
|
|
public double MinFlow { get; set; }
|
|
public double MaxFlow { get; set; }
|
|
public Dictionary<int, double> PressureDiff { get; set; }
|
|
public Dictionary<int,double > StdDev { get; set; }
|
|
public int Count { get; set; }
|
}
|
|
|
public class PumpMapping
|
{
|
public int Flag { get; set; }
|
public string PumpId { get; set; }
|
public string FlowId { get; set; }
|
public string PressureId { get; set; }
|
public string CurveId { get; set; }
|
public int PumpIndex { get; set; }
|
public int FlowIndex { get; set; }
|
public int PressureIndex { get; set; }
|
public int CurveIndex { get; set; }
|
|
}
|
|
public class StationMapping
|
{
|
public string Name { get; set; }
|
public string ScadaFlowId { get; set; }
|
public string ScadaPressureId { get; set; }
|
public string FlowId { get; set; }
|
public string PressureId { get; set; }
|
|
public int FlowIndex { get; set; }
|
public int PressureIndex { get; set; }
|
|
}
|
|
#endregion
|
|
|
#region Function
|
|
public static bool SaveAnalysisFactorDtoList(int station_index, List<Model.Equipment<Model.Pump>> eq_list, List<Tuple<int, double, double>> flag_hz_head_diff_list)
|
{
|
if (eq_list == null || !eq_list.Any())
|
{
|
return default;
|
}
|
if (flag_hz_head_diff_list == null || !flag_hz_head_diff_list.Any())
|
{
|
return default;
|
}
|
|
var flag_pump_dict = eq_list.ToDictionary(x => x.SortCode, x => x.RatedParas);
|
var all_list = GetAnalysisFactorDtoList(flag_pump_dict, flag_hz_head_diff_list);
|
if (all_list == null || !all_list.Any())
|
{
|
return default;
|
}
|
all_list.ForEach(x => x.Station = station_index);
|
var root_folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "分析");
|
if (!Directory.Exists(root_folder))
|
{
|
Directory.CreateDirectory(root_folder);
|
}
|
List<AnalysisFactorDto> exist_list = null;
|
var fileName = root_folder + "\\" + "AnalysisFactor.json";
|
if (File.Exists(fileName))
|
{
|
var exist_json = File.ReadAllText(fileName);
|
var all_exist_list = JsonHelper.Json2Object<List<AnalysisFactorDto>>(exist_json);
|
exist_list = all_exist_list?.Where(x => x.Station != station_index).ToList();
|
File.Delete(fileName);
|
}
|
if (exist_list != null)
|
{
|
all_list.AddRange(exist_list);
|
}
|
all_list = all_list.OrderBy(x => x.Flag).ThenBy(x => x.Hz).ToList();
|
var json = JsonHelper.Object2Json(all_list);
|
File.WriteAllText(fileName, json);
|
return true;
|
}
|
|
public static bool SaveAnalysisDeviationDtoList(int station_index, List<Model.Equipment<Model.Pump>> eq_list, List<Tuple<string, double, List<Tuple<int, double, double>>>> run_flags_flow_pressure_diff_dict, double minQ = 0, double maxQ = 100000, double spaceQ = 1000)
|
{
|
if (eq_list == null || !eq_list.Any())
|
{
|
return default;
|
}
|
if (run_flags_flow_pressure_diff_dict == null || !run_flags_flow_pressure_diff_dict.Any())
|
{
|
return default;
|
}
|
|
var flag_pump_dict = eq_list.ToDictionary(x => x.SortCode, x => x.RatedParas);
|
var all_list = GetAnalysisDeviationDtoList(flag_pump_dict, run_flags_flow_pressure_diff_dict, minQ, maxQ, spaceQ);
|
if (all_list == null || !all_list.Any())
|
{
|
return default;
|
}
|
all_list.ForEach(x => x.Station = station_index);
|
var root_folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "分析");
|
if (!Directory.Exists(root_folder))
|
{
|
Directory.CreateDirectory(root_folder);
|
}
|
|
List<AnalysisDeviationDto> exist_list = null;
|
var fileName = root_folder + "\\" + "AnalysisDeviation.json";
|
if (File.Exists(fileName))
|
{
|
var exist_json = File.ReadAllText(fileName);
|
var all_exist_list = JsonHelper.Json2Object<List<AnalysisDeviationDto>>(exist_json);
|
exist_list = all_exist_list?.Where(x => x.Station != station_index).ToList();
|
File.Delete(fileName);
|
}
|
if (exist_list != null)
|
{
|
all_list.AddRange(exist_list);
|
}
|
all_list = all_list.OrderBy(x => x.Station).ThenBy(x => x.MinFlow).ToList();
|
var json = JsonHelper.Object2Json(all_list);
|
File.WriteAllText(fileName, json);
|
return true;
|
}
|
|
|
public static bool SaveAnalysisFactorDtoListAdd(string name, List<Model.Equipment<Model.Pump>> eq_list, List<Tuple<int, double, double>> flag_hz_head_diff_list)
|
{
|
if (eq_list == null || !eq_list.Any())
|
{
|
return default;
|
}
|
if (flag_hz_head_diff_list == null || !flag_hz_head_diff_list.Any())
|
{
|
return default;
|
}
|
|
var flag_pump_dict = eq_list.ToDictionary(x => x.SortCode, x => x.RatedParas);
|
var all_analysis_factor_list = GetAnalysisFactorDtoList(flag_pump_dict, flag_hz_head_diff_list);
|
if (all_analysis_factor_list == null || !all_analysis_factor_list.Any())
|
{
|
return default;
|
}
|
var root_folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "分析系数");
|
if (!Directory.Exists(root_folder))
|
{
|
Directory.CreateDirectory(root_folder);
|
}
|
var fileName = root_folder + "\\" + name + ".json";
|
if (File.Exists(fileName))
|
{
|
var exist_json = File.ReadAllText(fileName);
|
var exist_all_analysis_factor_list = JsonHelper.Json2Object<List<AnalysisFactorDto>>(exist_json);
|
if (exist_all_analysis_factor_list != null && exist_all_analysis_factor_list.Any())
|
{
|
foreach (var item in all_analysis_factor_list)
|
{
|
var exist = exist_all_analysis_factor_list.Find(x => x.Flag == item.Flag && x.Hz == item.Hz);
|
if (exist == null)
|
continue;
|
item.HeadDeviation += exist.HeadDeviation;
|
}
|
}
|
}
|
var json = JsonHelper.Object2Json(all_analysis_factor_list);
|
File.WriteAllText(fileName, json);
|
return true;
|
}
|
|
|
public static List<AnalysisDeviationDto> GetAnalysisDeviationDtoList(Dictionary<int, Model.Pump> flag_pump_dict, List<Tuple<string, double, List<Tuple<int, double, double>>>> run_flags_flow_pressure_diff_dict, double minQ = 0, double maxQ = 100000, double spaceQ = 1000)
|
{
|
if (flag_pump_dict == null || !flag_pump_dict.Any())
|
{
|
return default;
|
}
|
if (run_flags_flow_pressure_diff_dict == null || !run_flags_flow_pressure_diff_dict.Any())
|
{
|
return default;
|
}
|
|
var list = new List<AnalysisDeviationDto>();
|
var error_value = false;
|
for (double current_minQ = minQ; current_minQ <= maxQ; current_minQ += spaceQ)
|
{
|
var current_maxQ = current_minQ + spaceQ;
|
var combine_list = run_flags_flow_pressure_diff_dict.Where(x => x.Item2 >= current_minQ && x.Item2 <= current_maxQ).ToList();
|
if (combine_list == null || !combine_list.Any())
|
continue;
|
var group_by_run_flags = combine_list.GroupBy(x => x.Item1);
|
foreach (var item_run_flags in group_by_run_flags)
|
{
|
if (item_run_flags.Count() < 5)
|
continue;
|
var flags = item_run_flags.Key;
|
var vm = new AnalysisDeviationDto();
|
vm.RunFlags = IStation.Untity.IntListHelper.ToList(flags);
|
vm.MinFlow = current_minQ;
|
vm.MaxFlow = current_maxQ;
|
var dev_dict = new Dictionary<int, double>();
|
List<Tuple<int, double, double>> tuple_list = item_run_flags.SelectMany(x => x.Item3).ToList();
|
var group_by_flag = tuple_list.GroupBy(x => x.Item1);
|
foreach (var flag_item in group_by_flag)
|
{
|
var flag = flag_item.Key;
|
var head_diff_array = flag_item.Select(x => x.Item3).ToArray();
|
var filter_std_dev_pop_tuple = AnalysisHelper.GetFilterBySTDP(head_diff_array);
|
var filter_std_dev_pop_array = filter_std_dev_pop_tuple.Item1;
|
var std_dev_pop = filter_std_dev_pop_tuple.Item2;
|
var std_dev_pop_head_avg = filter_std_dev_pop_array.Average();
|
var head_diff_avg = std_dev_pop_head_avg;
|
head_diff_avg = Math.Round(head_diff_avg, 5);
|
dev_dict.Add(flag, head_diff_avg);
|
}
|
vm.Count = item_run_flags.Count();
|
vm.PressureDiff = dev_dict;
|
error_value = false;
|
foreach (var dev in dev_dict)
|
{
|
if (Math.Abs(dev.Value) > 3)
|
{
|
error_value = true;
|
break;
|
}
|
}
|
if (error_value)
|
{
|
continue;
|
}
|
list.Add(vm);
|
}
|
}
|
|
return list;
|
}
|
|
public static List<AnalysisDeviationDto> GetCalcFlowAnalysisDeviationDtoList(Dictionary<int, Model.Pump> flag_pump_dict, List<Tuple<string, double, List<Tuple<int, double, double>>>> run_flags_flow_pressure_diff_dict, double minQ = 0, double maxQ = 100000, double spaceQ = 1000)
|
{
|
if (flag_pump_dict == null || !flag_pump_dict.Any())
|
{
|
return default;
|
}
|
if (run_flags_flow_pressure_diff_dict == null || !run_flags_flow_pressure_diff_dict.Any())
|
{
|
return default;
|
}
|
|
var list = new List<AnalysisDeviationDto>();
|
var error_value = false;
|
var opt_std_dev_pop = 0.3;
|
for (double current_minQ = minQ; current_minQ <= maxQ; current_minQ += spaceQ)
|
{
|
var current_maxQ = current_minQ + spaceQ;
|
var combine_list = run_flags_flow_pressure_diff_dict.Where(x => x.Item2 >= current_minQ && x.Item2 <= current_maxQ).ToList();
|
if (combine_list == null || !combine_list.Any())
|
continue;
|
var group_by_run_flags = combine_list.GroupBy(x => x.Item1);
|
foreach (var item_run_flags in group_by_run_flags)
|
{
|
if (item_run_flags.Count() < 5)
|
continue;
|
var flags = item_run_flags.Key;
|
var vm = new AnalysisDeviationDto();
|
vm.RunFlags = IStation.Untity.IntListHelper.ToList(flags);
|
vm.MinFlow = current_minQ;
|
vm.MaxFlow = current_maxQ;
|
var dev_dict = new Dictionary<int, double>();
|
List<Tuple<int, double, double>> tuple_list = item_run_flags.SelectMany(x => x.Item3).ToList();
|
var group_by_flag = tuple_list.GroupBy(x => x.Item1);
|
foreach (var flag_item in group_by_flag)
|
{
|
var flag = flag_item.Key;
|
var pump = flag_pump_dict[flag];
|
|
var head_diff_list = flag_item.Select(x => x.Item3).ToList();
|
var head_filter_tuple = AnalysisHelper.GetFilterBySTDP(head_diff_list.ToArray(), opt_std_dev_pop);
|
var head_filter_array = head_filter_tuple.Item1;
|
var head_std_dev_pop = head_filter_tuple.Item2;
|
var head_std_dev_pop_head_avg = head_filter_array.Average();
|
|
var flow_list = flag_item.Select(x => x.Item2).ToList();
|
var flow_filter_tuple = AnalysisHelper.GetFilterBySTDP(flow_list.ToArray(), 50, 1, 3);
|
var flow_filter_array = flow_filter_tuple.Item1;
|
var flow_std_dev_pop = flow_filter_tuple.Item2;
|
var flow_std_dev_pop_head_avg = flow_filter_array.Average();
|
|
var other_press = Model.CurveCalcuHelper.CalculateOtherPress(flow_std_dev_pop_head_avg, pump.Ic, pump.Oc, null, null);
|
//if (!pump.IsBp)
|
//{
|
// other_press = 0;
|
//}
|
var head_diff_avg = head_std_dev_pop_head_avg - other_press;
|
head_diff_avg = Math.Round(head_diff_avg, 6);
|
dev_dict.Add(flag, head_diff_avg);
|
}
|
vm.Count = item_run_flags.Count();
|
vm.PressureDiff = dev_dict;
|
error_value = false;
|
foreach (var dev in dev_dict)
|
{
|
if (Math.Abs(dev.Value) > 3)
|
{
|
error_value = true;
|
break;
|
}
|
}
|
if (error_value)
|
{
|
continue;
|
}
|
list.Add(vm);
|
}
|
}
|
|
return list;
|
}
|
|
|
|
public static List<AnalysisFactorDto> GetAnalysisFactorDtoList(Dictionary<int, Model.Pump> flag_pump_dict, List<Tuple<int, double, double>> flag_hz_head_diff_list)
|
{
|
if (flag_pump_dict == null || !flag_pump_dict.Any())
|
{
|
return default;
|
}
|
if (flag_hz_head_diff_list == null || !flag_hz_head_diff_list.Any())
|
{
|
return default;
|
}
|
|
var exist_data_analysis_factor_list = new List<AnalysisFactorDto>();
|
var opt_std_dev_pop = 0.3;
|
|
//分析5hz范围内的系数
|
var group_by_flag = flag_hz_head_diff_list.GroupBy(x => x.Item1);
|
var flag_range5_hz_factor_dict = new Dictionary<int, Dictionary<double, Tuple<double, double, int>>>();
|
foreach (var flag_item in group_by_flag)
|
{
|
var flag = flag_item.Key;
|
var pump = flag_pump_dict[flag];
|
if (!pump.IsBp)
|
continue;
|
|
for (double i = 20; i <= 50; i += 5)
|
{
|
var min_hz = i - 5;
|
double max_hz = i;
|
|
var list = flag_item.Where(x => x.Item2 >= min_hz && x.Item2 <= max_hz).ToList();
|
if (list == null || list.Count() < 10)
|
continue;
|
|
var head_diff_list = list.Select(x => x.Item3).ToList();
|
|
var filter_tuple = GetFilterBySTDP(head_diff_list.ToArray(), opt_std_dev_pop);
|
var filter_array = filter_tuple.Item1;
|
var std_dev_pop = filter_tuple.Item2;
|
var std_dev_pop_head_avg = filter_array.Average();
|
|
if (!flag_range5_hz_factor_dict.ContainsKey(flag))
|
{
|
flag_range5_hz_factor_dict.Add(flag, new Dictionary<double, Tuple<double, double, int>>());
|
}
|
|
flag_range5_hz_factor_dict[flag].Add(max_hz, new Tuple<double, double, int>(std_dev_pop, std_dev_pop_head_avg, filter_array.Count()));
|
}
|
}
|
|
|
//分析1hz范围内的系数
|
var group_by_flag_hz = flag_hz_head_diff_list.GroupBy(x => new { x.Item1, x.Item2 });
|
foreach (var item in group_by_flag_hz)
|
{
|
var hz = item.Key.Item2;
|
if (hz < 20)
|
continue;
|
if (item.Count() < 5)
|
continue;
|
|
|
var flag = item.Key.Item1;
|
var pump = flag_pump_dict[flag];
|
var head_diff_list = item.Select(x => x.Item3).ToList();
|
var filter_std_dev_pop_tuple = GetFilterBySTDP(head_diff_list.ToArray(), opt_std_dev_pop);
|
var filter_std_dev_pop_array = filter_std_dev_pop_tuple.Item1;
|
var std_dev_pop = filter_std_dev_pop_tuple.Item2;
|
var std_dev_pop_head_avg = filter_std_dev_pop_array.Average();
|
var head_diff_avg = std_dev_pop_head_avg;
|
if (Math.Abs(head_diff_avg) > 5)
|
continue;
|
if (Math.Abs(std_dev_pop) > 1)
|
continue;
|
|
if (Math.Abs(std_dev_pop) > 0.5 && item.Count() < 10)
|
continue;
|
|
var analysis_facotr = new AnalysisFactorDto();
|
analysis_facotr.Flag = flag;
|
analysis_facotr.Hz = hz;
|
analysis_facotr.HeadSTDP = std_dev_pop;
|
analysis_facotr.HeadDeviation = std_dev_pop_head_avg;
|
analysis_facotr.Accuracy = 0;
|
exist_data_analysis_factor_list.Add(analysis_facotr);
|
}
|
exist_data_analysis_factor_list = exist_data_analysis_factor_list.OrderBy(x => x.Flag).ThenBy(x => x.Hz).ToList();
|
|
//相似换算修正系数(不存在监测数据的频率)
|
var similar_analysis_factor_list = new List<AnalysisFactorDto>();
|
foreach (var pump_item in flag_pump_dict)
|
{
|
var flag = pump_item.Key;
|
var pump = pump_item.Value;
|
if (!pump.IsBp)
|
continue;
|
if (!flag_range5_hz_factor_dict.ContainsKey(flag))
|
continue;
|
var range5_hz_item = flag_range5_hz_factor_dict[flag];
|
for (int hz = 1; hz <= 50; hz++)
|
{
|
if (exist_data_analysis_factor_list.Exists(x => x.Flag == flag && x.Hz == hz))
|
continue;
|
|
var hz_range_num = hz / 5;
|
var hz_key = (hz_range_num + 1) * 5;
|
if (hz_key > 50)
|
hz_key = 50;
|
if (range5_hz_item.ContainsKey(hz_key))
|
{
|
var item = range5_hz_item[hz_key];
|
var analysis_facotr = new AnalysisFactorDto();
|
analysis_facotr.Flag = flag;
|
analysis_facotr.Hz = hz;
|
analysis_facotr.HeadSTDP = item.Item1;
|
analysis_facotr.HeadDeviation = item.Item2;
|
analysis_facotr.Accuracy = 0;
|
similar_analysis_factor_list.Add(analysis_facotr);
|
}
|
else
|
{
|
var hz_list = range5_hz_item.Select(x => x.Key).ToList();
|
var similar_hz = hz_list.Where(x => x >= hz_key)?.OrderBy(x => x).FirstOrDefault();
|
if (similar_hz == null || similar_hz.Value == 0)
|
{
|
similar_hz = hz_list.OrderByDescending(x => x).FirstOrDefault();
|
}
|
if (similar_hz == null)
|
{
|
throw new Exception("similar_hz error");
|
}
|
var tuple = range5_hz_item[similar_hz.Value];
|
var similar_ratio = hz / similar_hz.Value;
|
var head_dev = tuple.Item2 * similar_ratio;
|
var head_stdp = tuple.Item1 * similar_ratio;
|
|
var analysis_facotr = new AnalysisFactorDto();
|
analysis_facotr.Flag = flag;
|
analysis_facotr.Hz = hz;
|
analysis_facotr.HeadSTDP = head_stdp;
|
analysis_facotr.HeadDeviation = head_dev;
|
analysis_facotr.Accuracy = -1;
|
similar_analysis_factor_list.Add(analysis_facotr);
|
}
|
}
|
}
|
|
var all_analysis_factor_list = new List<AnalysisFactorDto>();
|
all_analysis_factor_list.AddRange(exist_data_analysis_factor_list);
|
all_analysis_factor_list.AddRange(similar_analysis_factor_list);
|
all_analysis_factor_list = all_analysis_factor_list.OrderBy(x => x.Flag).ThenBy(x => x.Hz).ToList();
|
return all_analysis_factor_list;
|
}
|
|
public static Tuple<double[], double> GetFilterBySTDP(double[] array, double min_dev = 0.3, int start_index = 0, int max_iteration_count = 1)
|
{
|
if (array == null || !array.Any())
|
{
|
return default;
|
}
|
var array_avg = array.Average();
|
var array_count = array.Count();
|
|
|
FilterOutliersHelper.STDEV(array, out double std_dev, out double std_dev_pop);
|
if (Math.Abs(std_dev_pop) < min_dev)
|
{
|
return new Tuple<double[], double>(array, std_dev_pop);
|
}
|
if (start_index > max_iteration_count)
|
{
|
return new Tuple<double[], double>(array, std_dev_pop);
|
}
|
var filter_array = array.Where(x => !(Math.Abs(x - array_avg) > Math.Abs(std_dev_pop * 2))).ToArray();
|
if (filter_array == null || !filter_array.Any())
|
{
|
return default;
|
}
|
start_index++;
|
return GetFilterBySTDP(filter_array, min_dev, start_index, max_iteration_count);
|
}
|
|
public static List<StationMapping> GetStationMappingList()
|
{
|
var list = new List<StationMapping>();
|
var dn2400 = new StationMapping();
|
var dn2700 = new StationMapping();
|
var jd1 = new StationMapping();
|
var jd2 = new StationMapping();
|
var jd3 = new StationMapping();
|
|
|
|
jd1.Name = "JD1";
|
jd2.Name = "JD2";
|
jd3.Name = "JD3";
|
dn2400.Name = "DN2400";
|
dn2700.Name = "SN2700";
|
|
|
jd1.ScadaFlowId = "SFJD1";
|
jd2.ScadaFlowId = "SFJD2";
|
jd3.ScadaFlowId = "SFJD3";
|
dn2400.ScadaFlowId = "SFDN2400";
|
dn2700.ScadaFlowId = "SFDN2700";
|
|
|
jd1.ScadaPressureId = "SPJD1";
|
jd2.ScadaPressureId = "SPJD2";
|
jd3.ScadaPressureId = "SPJD3";
|
dn2400.ScadaPressureId = "SPDN2400";
|
dn2700.ScadaPressureId = "SPDN2700";
|
|
jd1.FlowId = "Pjd1";
|
jd2.FlowId = "Pjd2";
|
jd3.FlowId = "Pjd3";
|
dn2400.FlowId = "Pdn2400";
|
dn2700.FlowId = "Pdn2700";
|
|
jd1.PressureId = "Jjd1";
|
jd2.PressureId = "Jjd2";
|
jd3.PressureId = "Jjd3";
|
dn2400.PressureId = "Jdn2400";
|
dn2700.PressureId = "Jdn2700";
|
|
list.Add(jd1);
|
list.Add(jd2);
|
list.Add(jd3);
|
list.Add(dn2400);
|
list.Add(dn2700);
|
return list;
|
}
|
|
public static List<PumpMapping> GetPumpModelMappingList()
|
{
|
var list = new List<PumpMapping>();
|
|
var pump11 = new PumpMapping();
|
var pump12 = new PumpMapping();
|
var pump13 = new PumpMapping();
|
var pump14 = new PumpMapping();
|
var pump15 = new PumpMapping();
|
var pump16 = new PumpMapping();
|
var pump17 = new PumpMapping();
|
var pump18 = new PumpMapping();
|
var pump21 = new PumpMapping();
|
var pump22 = new PumpMapping();
|
var pump23 = new PumpMapping();
|
var pump24 = new PumpMapping();
|
var pump25 = new PumpMapping();
|
var pump26 = new PumpMapping();
|
var pump27 = new PumpMapping();
|
|
pump11.Flag = GlobalHelperW.Flag11;
|
pump12.Flag = GlobalHelperW.Flag12;
|
pump13.Flag = GlobalHelperW.Flag13;
|
pump14.Flag = GlobalHelperW.Flag14;
|
pump15.Flag = GlobalHelperW.Flag15;
|
pump16.Flag = GlobalHelperW.Flag16;
|
pump17.Flag = GlobalHelperW.Flag17;
|
pump18.Flag = GlobalHelperW.Flag18;
|
pump21.Flag = GlobalHelperW.Flag21;
|
pump22.Flag = GlobalHelperW.Flag22;
|
pump23.Flag = GlobalHelperW.Flag23;
|
pump24.Flag = GlobalHelperW.Flag24;
|
pump25.Flag = GlobalHelperW.Flag25;
|
pump26.Flag = GlobalHelperW.Flag26;
|
pump27.Flag = GlobalHelperW.Flag27;
|
|
pump11.PumpId = "Pump11";
|
pump12.PumpId = "Pump12";
|
pump13.PumpId = "Pump13";
|
pump14.PumpId = "Pump14";
|
pump15.PumpId = "Pump15";
|
pump16.PumpId = "Pump16";
|
pump17.PumpId = "Pump17";
|
pump18.PumpId = "Pump18";
|
pump21.PumpId = "Pump21";
|
pump22.PumpId = "Pump22";
|
pump23.PumpId = "Pump23";
|
pump24.PumpId = "Pump24";
|
pump25.PumpId = "Pump25";
|
pump26.PumpId = "Pump26";
|
pump27.PumpId = "Pump27";
|
|
pump11.FlowId = "";
|
pump12.FlowId = "";
|
pump13.FlowId = "";
|
pump14.FlowId = "";
|
pump15.FlowId = "";
|
pump16.FlowId = "";
|
pump17.FlowId = "";
|
pump18.FlowId = "";
|
pump21.FlowId = "Ppump21";
|
pump22.FlowId = "Ppump22";
|
pump23.FlowId = "Ppump23";
|
pump24.FlowId = "Ppump24";
|
pump25.FlowId = "Ppump25";
|
pump26.FlowId = "Ppump26";
|
pump27.FlowId = "Ppump27";
|
|
pump11.PressureId = "Jpump11";
|
pump12.PressureId = "Jpump12";
|
pump13.PressureId = "Jpump13";
|
pump14.PressureId = "Jpump14";
|
pump15.PressureId = "Jpump15";
|
pump16.PressureId = "Jpump16";
|
pump17.PressureId = "Jpump17";
|
pump18.PressureId = "Jpump18";
|
pump21.PressureId = "Jpump21";
|
pump22.PressureId = "Jpump22";
|
pump23.PressureId = "Jpump23";
|
pump24.PressureId = "Jpump24";
|
pump25.PressureId = "Jpump25";
|
pump26.PressureId = "Jpump26";
|
pump27.PressureId = "Jpump27";
|
|
pump11.CurveId = "11";
|
pump12.CurveId = "12";
|
pump13.CurveId = "13";
|
pump14.CurveId = "14";
|
pump15.CurveId = "15";
|
pump16.CurveId = "16";
|
pump17.CurveId = "17";
|
pump18.CurveId = "18";
|
pump21.CurveId = "21";
|
pump22.CurveId = "22";
|
pump23.CurveId = "23";
|
pump24.CurveId = "24";
|
pump25.CurveId = "25";
|
pump26.CurveId = "26";
|
pump27.CurveId = "27";
|
|
|
list.Add(pump11);
|
list.Add(pump12);
|
list.Add(pump13);
|
list.Add(pump14);
|
list.Add(pump15);
|
list.Add(pump16);
|
list.Add(pump17);
|
list.Add(pump18);
|
list.Add(pump21);
|
list.Add(pump22);
|
list.Add(pump23);
|
list.Add(pump24);
|
list.Add(pump25);
|
list.Add(pump26);
|
list.Add(pump27);
|
return list;
|
}
|
|
public static List<string> GetPatternIdList()
|
{
|
var list = new List<string>();
|
list.Add("Pump11");
|
list.Add("Pump12");
|
list.Add("Pump13");
|
list.Add("Pump14");
|
list.Add("Pump15");
|
list.Add("Pump16");
|
list.Add("Pump17");
|
list.Add("Pump18");
|
list.Add("R3");
|
list.Add("R2");
|
list.Add("R1");
|
list.Add("SFJD1");
|
list.Add("SFJD2");
|
list.Add("SFJD3");
|
list.Add("RPump21");
|
list.Add("RPump22");
|
list.Add("RPump23");
|
list.Add("RPump24");
|
list.Add("RPump25");
|
list.Add("RPump26");
|
list.Add("RPump27");
|
list.Add("SFPump21");
|
list.Add("SFPump22");
|
list.Add("SFPump23");
|
list.Add("SFPump24");
|
list.Add("SFPump25");
|
list.Add("SFPump26");
|
list.Add("SFPump27");
|
list.Add("Pump21");
|
list.Add("Pump22");
|
list.Add("Pump23");
|
list.Add("Pump24");
|
list.Add("Pump25");
|
list.Add("Pump26");
|
list.Add("Pump27");
|
list.Add("SFDN2400");
|
list.Add("SFDN2700");
|
return list;
|
}
|
|
public static Dictionary<string, double> GetWLDict(Dictionary<int, double> flag_pressure_diff_dev)
|
{
|
if (flag_pressure_diff_dev == null || !flag_pressure_diff_dev.Any())
|
{
|
return default;
|
}
|
|
var wl_dict = new Dictionary<string, double>();
|
wl_dict.Add("R3", 0);
|
wl_dict.Add("R2", 0);
|
wl_dict.Add("R1", 0);
|
|
wl_dict.Add("RPump21", 0);
|
wl_dict.Add("RPump22", 0);
|
wl_dict.Add("RPump23", 0);
|
wl_dict.Add("RPump24", 0);
|
wl_dict.Add("RPump25", 0);
|
wl_dict.Add("RPump26", 0);
|
wl_dict.Add("RPump27", 0);
|
|
|
double? r1 = null, r2 = null;
|
foreach (var item in flag_pressure_diff_dev)
|
{
|
var flag = item.Key;
|
var pressure_diff_dev = item.Value;
|
|
if (flag < 16 && r2 == null)
|
{
|
r2 = pressure_diff_dev;
|
wl_dict["R2"] = r2 ?? 0;
|
}
|
else if (flag < 21 && r1 == null)
|
{
|
r1 = pressure_diff_dev;
|
wl_dict["R1"] = r1 ?? 0;
|
}
|
else
|
{
|
switch (flag)
|
{
|
case 21: wl_dict["RPump21"] = pressure_diff_dev; break;
|
case 22: wl_dict["RPump22"] = pressure_diff_dev; break;
|
case 23: wl_dict["RPump23"] = pressure_diff_dev; break;
|
case 24: wl_dict["RPump24"] = pressure_diff_dev; break;
|
case 25: wl_dict["RPump25"] = pressure_diff_dev; break;
|
case 26: wl_dict["RPump26"] = pressure_diff_dev; break;
|
case 27: wl_dict["RPump27"] = pressure_diff_dev; break;
|
default:
|
break;
|
}
|
}
|
}
|
|
return wl_dict;
|
|
}
|
|
#endregion
|
|
}
|
}
|