| | |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | |
| | | namespace IStation.WinFrmUI.Monitor |
| | | { |
| | |
| | | _series_correct_curve_head.CrosshairLabelPattern = "修正值:{V}"; |
| | | _series_head_diff.CrosshairLabelPattern = "偏差值:{V}"; |
| | | _series_hz.CrosshairLabelPattern = "频率:{V}"; |
| | | |
| | | |
| | | |
| | | //定制窗格的滚动条的外观 |
| | | ScrollBarOptions scrollBarOptions = _diagram.DefaultPane.ScrollBarOptions; |
| | |
| | | AlertTool.ShowInfo(System.Windows.Forms.Application.OpenForms[0], "提示", "导出完成!"); |
| | | } |
| | | |
| | | private void barBtnQueryMinAndMaxRpmFlow_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_monitorDataSources == null || _station == null) |
| | | { |
| | | return; |
| | | } |
| | | //if (this.barCekLoad.Checked) |
| | | //{ |
| | | // return; |
| | | //} |
| | | var packets = _bll.Get(_monitorDataSources.ID, _station.ID); |
| | | var pump_list = new BLL.Equipment().GetPumpListByBelongTypeAndBelongID(IStation.ObjectType.Station, _station.ID); |
| | | var flag_list = pump_list.Select(x => x.SortCode).OrderBy(x => x).ToList(); |
| | | var flag_pump_dict = pump_list.ToDictionary(x => x.SortCode, x => x.RatedParas); |
| | | var flag_qh_curve_dict = new Dictionary<int, Model.CurveExpress>(); |
| | | var bll_curve = new BLL.PumpCurve(); |
| | | foreach (var pump in pump_list) |
| | | { |
| | | Model.CurveExpress qh = null; |
| | | var curve_info = bll_curve.GetDefaultWorkingByPumpID(pump.ID)?.CurveInfo; |
| | | if (curve_info?.CurveQH != null) |
| | | { |
| | | qh = curve_info.CurveQH; |
| | | } |
| | | flag_qh_curve_dict.Add(pump.SortCode, qh); |
| | | } |
| | | |
| | | var pump_record_list = packets.SelectMany(x => x.StationSignalRecords.SelectMany(s => s.PumpSignalRecords)).ToList(); |
| | | var flag_pump_record_list = pump_record_list.OrderBy(x=>x.Flag).GroupBy(x => x.Flag); |
| | | |
| | | var str_build = new StringBuilder(); |
| | | var min_sum_flow = 0d; |
| | | var max_sum_flow = 0d; |
| | | foreach (var item in flag_pump_record_list) |
| | | { |
| | | var flag = item.Key; |
| | | var pump = flag_pump_dict[flag]; |
| | | if (item.Count() < 100) |
| | | continue; |
| | | |
| | | if (pump.IsBp) |
| | | { |
| | | var record_list = item.Where(x => x.Rpm >= 100).OrderBy(x => x.Rpm).ToList(); |
| | | if (!record_list.Any()) |
| | | continue; |
| | | var low_record_list = record_list.Take(500).ToList(); |
| | | var low_rpm_item = GetNum(low_record_list.Select(x => x.Rpm).ToList()); |
| | | var low_avg_head = low_record_list.Where(x => x.Rpm == low_rpm_item.Item1).Average(x => x.Head); |
| | | |
| | | record_list = record_list.OrderByDescending(x => x.Rpm).ToList(); |
| | | var high_record_list = record_list.Take(500).ToList(); |
| | | var high_rpm_item = GetNum(high_record_list.Select(x => x.Rpm).ToList()); |
| | | var high_avg_head = high_record_list.Where(x => x.Rpm == high_rpm_item.Item1).Average(x => x.Head); |
| | | |
| | | var low_rpm = low_rpm_item.Item1; |
| | | var high_rpm = high_rpm_item.Item1; |
| | | var low_qh = Model.CurveCalcuHelper.CalculateSimilarQH(flag_qh_curve_dict[flag], pump.Nr, low_rpm); |
| | | var high_qh = Model.CurveCalcuHelper.CalculateSimilarQH(flag_qh_curve_dict[flag], pump.Nr, high_rpm); |
| | | |
| | | var low_flow = Model.FitCurveHelper.GetInterPointExX(low_qh.GetFitPoints(), low_avg_head).First().X; |
| | | var high_flow = Model.FitCurveHelper.GetInterPointX(high_qh.GetFitPoints(), high_avg_head).First().X; |
| | | |
| | | min_sum_flow += Math.Round(low_flow, 0); |
| | | max_sum_flow += Math.Round(high_flow, 0); |
| | | str_build.AppendLine($"{flag}#"); |
| | | str_build.AppendLine($"最小转速:{low_rpm_item.Item1}(时间点数量:{low_rpm_item.Item2}) 平均扬程={low_avg_head:N2} 曲线流量:{low_flow:N0}"); |
| | | str_build.AppendLine($"最大转速:{high_rpm_item.Item1}(时间点数量:{high_rpm_item.Item2}) 平均扬程={high_avg_head:N2} 曲线流量={high_flow:N0}"); |
| | | } |
| | | else |
| | | { |
| | | //var record_list = item.OrderBy(x => x.Head).ToList(); |
| | | //var low_record_list = record_list.Take(500).ToList(); |
| | | //var low_avg_head = low_record_list.Average(x => x.Head); |
| | | |
| | | //record_list = record_list.OrderByDescending(x => x.Head).ToList(); |
| | | //var high_record_list = record_list.Take(500).ToList(); |
| | | //var high_avg_head = high_record_list.Average(x => x.Head); |
| | | |
| | | //var low_flow = Model.FitCurveHelper.GetInterPointExX(flag_qh_curve_dict[flag].GetFitPoints(), low_avg_head).First().X; |
| | | //var high_flow = Model.FitCurveHelper.GetInterPointX(flag_qh_curve_dict[flag].GetFitPoints(), high_avg_head).First().X; |
| | | |
| | | //min_sum_flow += Math.Round(low_flow, 0); |
| | | //max_sum_flow += Math.Round(high_flow, 0); |
| | | //str_build.AppendLine($"{flag}#"); |
| | | //str_build.AppendLine($"最小转速:{pump.Nr}(时间点数量:{500}) 平均扬程={low_avg_head:N2} 曲线流量:{low_flow:N0}"); |
| | | //str_build.AppendLine($"最大转速:{pump.Nr}(时间点数量:{500}) 平均扬程={high_avg_head:N2} 曲线流量={high_flow:N0}"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | str_build.AppendLine($"最小流量:{min_sum_flow:N0} 最大流量:{max_sum_flow:N0}"); |
| | | var msg = str_build.ToString(); |
| | | |
| | | } |
| | | |
| | | private Tuple<double,double> GetNum(List<double> list) |
| | | { |
| | | var groups = list.GroupBy(x => x); |
| | | var max_count_item = groups.OrderBy(x => x.Count()).Last(); |
| | | return new Tuple<double, double>(max_count_item.Key,max_count_item.Count()); |
| | | } |
| | | } |
| | | } |