qin
2025-03-21 b6da0632c9704414934df0817386976eca1548a2
WinFrmUI/PBS.WinFrmUI.DataAnalysis/EnergyAnalysis.cs
@@ -111,7 +111,7 @@
            colTime.Caption = "时间";
            colTime.Visible = true;
            view.Columns.Add(colTime);
            var totalFlow = new List<double>();
            foreach (var vm in vm_list)
            {
                if (!vm.Name.Contains("压力"))
@@ -119,6 +119,7 @@
                    axis_x = _axis_x_flow;
                    axis_y = _axis_y_head;
                    pane = _default_pane;
                    totalFlow = vm.Datas.Select(c => c.Y).ToList();
                }
                else
                {
@@ -136,10 +137,28 @@
                AddLineSeries(vm.Name, axis_x, axis_y, pane, vm.Datas);
            }
            var tempdatas = vm_list[0];
            double totalEl = 0;
            double totalOldEl = 0;
            double totalFy = 0;
            var tempdatas = vm_list.FirstOrDefault(c => c.Name.Contains("压力"));
            var tempflow = vm_list.FirstOrDefault(c => c.Name.Contains("流量"));
            foreach (var item in tempdatas.Datas)
            {
                item.Y = Press;
                var flow = tempflow.Datas.FirstOrDefault(c => c.Time == item.Time);
                if (flow != null)
                {
                    var oldpressM = Yw.Pump.CalculationHelper.Mpa2M(Press);
                    var newpressM = Yw.Pump.CalculationHelper.Mpa2M(item.Y);
                    var oldel = Yw.Pump.CalculationHelper.CalcuP(flow.Y, oldpressM, Efficiency);
                    var newel = Yw.Pump.CalculationHelper.CalcuP(flow.Y, newpressM, Efficiency);
                    var el = oldel - newel;
                    totalOldEl += oldel;
                    totalEl += el;
                    var Fy = ElecPriceHelper.CalcuShysElectricityFees(DateTime.Parse(item.Time), el);
                    totalFy += Fy;
                }
                item.Y = Press;//Yw.Pump.CalculationHelper.CalcuP();
            }
            AddLineSeries("原泵后压力", axis_x, _axis_y_eff, _default_pane, tempdatas.Datas);
@@ -155,7 +174,11 @@
            _axis_x_flow.VisualRange.SetMinMaxValues(min_x, max_x);
            var diff_days = max_x - min_x;
            textEdit1.Text =  diff_days.TotalDays.ToString();
            textEdit1.Text = Math.Round(diff_days.TotalDays).ToString();
            textEdit2.Text = Math.Round(totalFlow.Sum() / 60).ToString();
            textEdit3.Text = Math.Round(totalEl).ToString();
            textEdit4.Text = Math.Round(totalEl / totalOldEl * 100).ToString();
            textEdit5.Text = Math.Round(totalFy).ToString();
            gridControl1.DataSource = dataTable;
            this.chartControl1.EndInit();
@@ -317,7 +340,7 @@
                dataTable.Rows.Add(rowData);
            }
            //Yw.Pump.CalculationHelper.CalcuP();
            return "";
@@ -325,12 +348,15 @@
        }
        double Press = 0.6;
        double Efficiency = 75;
        SetPressForm dlg = new SetPressForm();
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dlg = new SetPressForm();
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Press = dlg.Press;
                Efficiency = dlg.Efficiency;
            }
        }
    }