| | |
| | | using DevExpress.PivotGrid.PivotTable; |
| | | using DevExpress.XtraEditors; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using Yw.Geometry; |
| | | using System.Data; |
| | | using Yw.Pump; |
| | | using Yw.WinFrmUI.Phart; |
| | | |
| | |
| | | //保存 |
| | | private void btnSave_Click(object sender, EventArgs e) |
| | | { |
| | | var result = XtraMessageBox.Show("是否将现有水泵状态更新模型?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes; |
| | | var result = XtraMessageBox.Show("是否使用现有水泵状态更新模型?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes; |
| | | if (!result) |
| | | { |
| | | return; |
| | |
| | | var vm = new PumpParallelViewModel(); |
| | | vm.Id = item.Code; |
| | | vm.Name = item.Name; |
| | | vm.RatedQ = item.Vmo.RatedQ.HasValue ? item.Vmo.RatedQ.Value : 0; |
| | | vm.RatedH = item.Vmo.RatedH.HasValue ? item.Vmo.RatedH.Value : 0; |
| | | vm.RatedQ = item.Vmo.RatedQ; |
| | | vm.RatedH = item.Vmo.RatedH; |
| | | vm.RatedP = item.Vmo.RatedP; |
| | | vm.RatedN = item.Vmo.RatedN.HasValue ? item.Vmo.RatedN.Value : 0; |
| | | vm.RatedN = item.Vmo.RatedN; |
| | | vm.RatedHz = item.Vmo.RatedHz; |
| | | vm.CurrentHz = item.Hz; |
| | | vm.CurrentN = Math.Round(item.Hz / item.Vmo.RatedHz * vm.RatedN, 1); |
| | |
| | | var qh_pts = curveqh.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | if (qh_pts != null && qh_pts.Count > 3) |
| | | { |
| | | vm.CurveQH = new CubicSpline2d(qh_pts); |
| | | vm.CurveQH = qh_pts; |
| | | var qh_current_pts = qh_pts.GetQHPointListByN(item.Vmo.RatedHz, item.Hz); |
| | | vm.CurrentCurveQH = new CubicSpline2d(qh_current_pts); |
| | | vm.CurrentCurveQH = qh_current_pts; |
| | | if (item.Extend > 100) |
| | | { |
| | | vm.CurrentExtendFlow = vm.CurrentCurveQH.MaxX; |
| | | vm.CurrentExtendFlow = vm.CurrentCurveQH.Max(x => x.X); |
| | | extend = item.Extend / 100; |
| | | var qh_current_extend_pts = vm.CurrentCurveQH.GetPointListByXRatioRange(1, extend, 20); |
| | | vm.CurrentCurveQH = new CubicSpline2d(qh_current_extend_pts); |
| | | var qh_current_extend_pts = vm.CurrentCurveQH.GetExpandPointList(Yw.Ahart.eFeatType.Cubic, 1, extend, 20); |
| | | vm.CurrentCurveQH = qh_current_extend_pts; |
| | | } |
| | | } |
| | | } |
| | |
| | | var curveqp = item.HydroInfo.Curves?.Find(x => x.Code == item.Vmo.CurveQP); |
| | | if (curveqp != null) |
| | | { |
| | | var qppts = curveqp.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | if (qppts != null && qppts.Count > 3) |
| | | var qp_pts = curveqp.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | if (qp_pts != null && qp_pts.Count > 3) |
| | | { |
| | | vm.CurveQP = new CubicSpline2d(qppts); |
| | | var sqppts = qppts.GetQHPointListByN(item.Vmo.RatedHz, item.Hz); |
| | | vm.CurrentCurveQP = new CubicSpline2d(sqppts); |
| | | vm.CurveQP = qp_pts; |
| | | var qp_current_pts = qp_pts.GetQPPointListByN(item.Vmo.RatedHz, item.Hz); |
| | | vm.CurrentCurveQP = qp_current_pts; |
| | | if (extend > 1) |
| | | { |
| | | var qp_current_extend_pts = vm.CurrentCurveQP.GetPointListByXRatioRange(1, extend, 20); |
| | | vm.CurrentCurveQP = new CubicSpline2d(qp_current_extend_pts); |
| | | var qp_current_extend_pts = vm.CurrentCurveQP.GetExpandPointList(Yw.Ahart.eFeatType.Cubic, 1, extend, 20); |
| | | vm.CurrentCurveQP = qp_current_extend_pts; |
| | | } |
| | | } |
| | | } |
| | |
| | | var curveqe = item.HydroInfo.Curves?.Find(x => x.Code == item.Vmo.CurveQE); |
| | | if (curveqe != null) |
| | | { |
| | | var qepts = curveqe.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | if (qepts != null && qepts.Count > 3) |
| | | var qe_pts = curveqe.CurveData?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | | if (qe_pts != null && qe_pts.Count > 3) |
| | | { |
| | | vm.CurveQE = new CubicSpline2d(qepts); |
| | | var sqepts = qepts.GetQHPointListByN(item.Vmo.RatedHz, item.Hz); |
| | | vm.CurrentCurveQE = new CubicSpline2d(sqepts); |
| | | vm.CurveQE = qe_pts; |
| | | var qe_current_pts = qe_pts.GetQEPointListByN(item.Vmo.RatedHz, item.Hz); |
| | | vm.CurrentCurveQE = qe_current_pts; |
| | | if (extend > 1) |
| | | { |
| | | var qe_current_extend_pts = vm.CurrentCurveQE.GetPointListByXRatioRange(1, extend, 20); |
| | | vm.CurrentCurveQE = new CubicSpline2d(qe_current_extend_pts); |
| | | var qe_current_extend_pts = vm.CurrentCurveQE.GetExpandPointList(Yw.Ahart.eFeatType.Cubic, 1, extend, 20); |
| | | vm.CurrentCurveQE = qe_current_extend_pts; |
| | | } |
| | | } |
| | | } |