| | |
| | | using DevExpress.XtraCharts; |
| | | using IStation.Epanet; |
| | | using IStation.Epanet; |
| | | using IStation.Epanet.Enums; |
| | | using IStation.Model; |
| | | using IStation.Untity; |
| | |
| | | public ModelCorrectionComparePage() |
| | | { |
| | | InitializeComponent(); |
| | | this.PageTitle.Caption = "模型修正对比"; |
| | | |
| | | |
| | | this.repositoryItemDateEdit1.SetOnlyShowYearMonth(); |
| | | this.repositoryItemDateEdit2.SetOnlyShowYearMonth(); |
| | | this.barEditDateStart.EditValue = new DateTime(2024, 9, 1); |
| | | this.barEditDateEnd.EditValue = new DateTime(2024, 9, 1); |
| | | |
| | | PageTitle.Caption = "模型修正对比"; |
| | | |
| | | this.barCekUseFlow.Checked = true; |
| | | |
| | | this.stationListCtrl1.FocusedChangedEvent += StationListCtrl1_FocusedChangedEvent; |
| | | this.monitorDataSourcesTreeList1.FocusedChangedEvent += MonitorDataSourcesListCtrl1_FocusedChangedEvent; |
| | | this.timeValueSwiftPlotChartView1.SetTimeAxisX(DevExpress.XtraCharts.DateTimeMeasureUnit.Minute); |
| | | |
| | | repositoryItemDateEdit1.SetOnlyShowYearMonth(); |
| | | repositoryItemDateEdit2.SetOnlyShowYearMonth(); |
| | | barEditDateStart.EditValue = new DateTime(2024, 9, 1); |
| | | barEditDateEnd.EditValue = new DateTime(2024, 9, 1); |
| | | |
| | | |
| | | barCekUseFlow.Checked = true; |
| | | |
| | | stationListCtrl1.FocusedChangedEvent += StationListCtrl1_FocusedChangedEvent; |
| | | monitorDataSourcesTreeList1.FocusedChangedEvent += MonitorDataSourcesListCtrl1_FocusedChangedEvent; |
| | | timeValueSwiftPlotChartView1.SetTimeAxisX(DevExpress.XtraCharts.DateTimeMeasureUnit.Minute); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | #region ViewModel |
| | | |
| | |
| | | { |
| | | public string Time { get; set; } |
| | | public string RunFlags { get; set; } |
| | | public double TotalFlow { get; set; } |
| | | public double TotalFlow { get; set; } |
| | | public Dictionary<int, double> PressureDiffDevDict { get; set; } |
| | | } |
| | | |
| | |
| | | |
| | | public void Round() |
| | | { |
| | | if (this.STDP.HasValue) |
| | | if (STDP.HasValue) |
| | | { |
| | | this.STDP = Math.Round(this.STDP.Value, 5); |
| | | STDP = Math.Round(STDP.Value, 5); |
| | | } |
| | | if (this.STDPHead.HasValue) |
| | | if (STDPHead.HasValue) |
| | | { |
| | | this.STDPHead = Math.Round(this.STDPHead.Value, 5); |
| | | STDPHead = Math.Round(STDPHead.Value, 5); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | private List<PumpViewModel> _pump_vm_list = null; |
| | | |
| | | private string _model_file = System.IO.Path.Combine |
| | | (Settings.File.RootDirectory, Settings.File.DataFolder, "ch2_v3_20240801(Clear).inp"); |
| | | (SettingsD.File.RootDirectory, SettingsD.File.DataFolder, "ch2_v3_20240801(Clear).inp"); |
| | | |
| | | /// <summary> |
| | | /// 清空数据 |
| | |
| | | public void Clear() |
| | | { |
| | | _pump_vm_list = new List<PumpViewModel>(); |
| | | _model_diff_vm_list = new List<StationViewModel>(); |
| | | this.timeValueSwiftPlotChartView1.ClearSeries(); |
| | | _model_diff_vm_list = new List<StationViewModel>(); |
| | | timeValueSwiftPlotChartView1.ClearSeries(); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public override void InitialDataSource() |
| | | { |
| | | this.stationListCtrl1.SetBindingData(); |
| | | this.monitorDataSourcesTreeList1.SetBindingData(); |
| | | stationListCtrl1.SetBindingData(); |
| | | monitorDataSourcesTreeList1.SetBindingData(); |
| | | } |
| | | |
| | | //泵站变换 |
| | |
| | | { |
| | | return; |
| | | } |
| | | if (this.barCekLoad.Checked) |
| | | if (barCekLoad.Checked) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | |
| | | var station_index = station.SortCode; |
| | | var dt_start = Convert.ToDateTime(this.barEditDateStart.EditValue); |
| | | var dt_end = Convert.ToDateTime(this.barEditDateEnd.EditValue); |
| | | var dt_start = Convert.ToDateTime(barEditDateStart.EditValue); |
| | | var dt_end = Convert.ToDateTime(barEditDateEnd.EditValue); |
| | | var packets = _bll.Get(monitorDataSources.ID, station.ID); |
| | | packets = packets?.Where(x => (x.Year >= dt_start.Year && x.Year <= dt_end.Year) && (x.Month >= dt_start.Month && x.Month <= dt_end.Month)).ToList(); |
| | | if (packets == null || !packets.Any()) |
| | |
| | | return; |
| | | } |
| | | var flag_pump_dict = _pump_list.ToDictionary(x => x.SortCode, x => x.RatedParas); |
| | | var flag_list = _pump_list.Select(x => x.SortCode).OrderBy(x => x).ToList(); |
| | | var flag_list = _pump_list.Select(x => x.SortCode).OrderBy(x => x).ToList(); |
| | | var record_list = packets.SelectMany(x => x.StationSignalRecords).ToList(); |
| | | |
| | | var root_folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "分析"); |
| | |
| | | var pump_mapping_dict = pump_mapping_list.ToDictionary(x => x.Flag, x => x); |
| | | var flag_qh_curve_dict = GetFlagCurveDict(); |
| | | |
| | | |
| | | Set(_model_file, record_list, station_mapping_list, pump_mapping_dict, flag_pump_dict, flag_qh_curve_dict,ana_factor_list, ana_deviation_list); |
| | | |
| | | Set(_model_file, record_list, station_mapping_list, pump_mapping_dict, flag_pump_dict, flag_qh_curve_dict, ana_factor_list, ana_deviation_list); |
| | | } |
| | | |
| | | |
| | | |
| | | #region Color |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | private Dictionary<int, Model.CurveExpress> GetFlagCurveDict() |
| | | { |
| | | var dict = new Dictionary<int, Model.CurveExpress>(); |
| | |
| | | |
| | | return dict; |
| | | } |
| | | |
| | | |
| | | |
| | | //加载 |
| | | private void barCekLoad_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | List<AnalysisHelper.AnalysisFactorDto> ana_factor_list, |
| | | List<AnalysisHelper.AnalysisDeviationDto> ana_deviation_list |
| | | ) |
| | | { |
| | | { |
| | | if (ana_factor_list == null || !ana_factor_list.Any()) |
| | | { |
| | | Clear(); |
| | |
| | | |
| | | var second_vm_pump_list = second_tuple.Item1; |
| | | var second_vm_station_list = second_tuple.Item2; |
| | | |
| | | |
| | | if (ana_deviation_list == null || !ana_deviation_list.Any()) |
| | | { |
| | | Clear(); |
| | |
| | | |
| | | int first_count = 0; |
| | | int second_count = 0; |
| | | |
| | | |
| | | var second_group = second_vm_station_list.GroupBy(x => x.Name); |
| | | for (int i = 0; i < second_group.Count(); i++) |
| | | { |
| | |
| | | .Select(x => new TimeValue(x.Date, x.PressureDiff)) |
| | | .ToList(); |
| | | |
| | | this.timeValueSwiftPlotChartView1.AddSwiftPlotSeries(name, color, name + "(修正)", "压力", list); |
| | | } |
| | | timeValueSwiftPlotChartView1.AddSwiftPlotSeries(name, color, name + "(修正)", "压力", list); |
| | | } |
| | | second_count = second_group.Count(); |
| | | |
| | | var third_group = third_vm_station_list.GroupBy(x => x.Name); |
| | | for (int i = 0; i < third_group.Count(); i++) |
| | | { |
| | | var color = GetRandomColor(i + first_count+second_count); |
| | | var color = GetRandomColor(i + first_count + second_count); |
| | | var item = third_group.ElementAt(i); |
| | | var name = item.Key; |
| | | var pressure_diff_list = item.Select(x => x.PressureDiff).ToList(); |
| | |
| | | .Select(x => new TimeValue(x.Date, x.PressureDiff)) |
| | | .ToList(); |
| | | |
| | | this.timeValueSwiftPlotChartView1.AddSwiftPlotSeries(name, color, name + "(二次修正)", "压力", list); |
| | | timeValueSwiftPlotChartView1.AddSwiftPlotSeries(name, color, name + "(二次修正)", "压力", list); |
| | | |
| | | } |
| | | |
| | |
| | | continue; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //设置模式 |
| | | foreach (var pattern in pattern_id_dict) |
| | |
| | | { |
| | | var run_flags = pump_record_list.Select(x => x.Flag).OrderBy(x => x).ToList(); |
| | | ana_dev = ana_dev_list.Find(x => x.RunFlags.SequenceEqual(run_flags)); |
| | | } |
| | | } |
| | | foreach (var pump_record in pump_record_list) |
| | | { |
| | | var flag = pump_record.Flag; |
| | |
| | | |
| | | var diff_V = Model.CurveCalcuHelper.CalculateOtherPress(flow_std_dev_pop_head_avg, pump.Ic, pump.Oc, null, null); |
| | | var head_diff_avg = -(pressure_diff_std_dev_pop_head_avg + diff_V); |
| | | |
| | | |
| | | diff_avg = head_diff_avg; |
| | | } |
| | | |
| | |
| | | |
| | | public List<AnalysisDeviationDto> AnalysisDeviationSet |
| | | ( |
| | | Dictionary<int, Model.Pump> flag_pump_dict, |
| | | List<Tuple<string, double, Dictionary<int, double>>> run_flags_flow_pressure_diff_dev_dict, |
| | | Dictionary<int, Model.Pump> flag_pump_dict, |
| | | List<Tuple<string, double, Dictionary<int, double>>> run_flags_flow_pressure_diff_dev_dict, |
| | | double minQ = 0, |
| | | double maxQ = 100000, |
| | | double spaceQ = 1000 |
| | |
| | | vm.Count = item_run_flags.Count(); |
| | | vm.PressureDiff = dev_dict; |
| | | list.Add(vm); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |