| | |
| | | private bool _qe_visible = true; |
| | | private bool _qp_visible = true; |
| | | |
| | | private bool _equip_visible = true; |
| | | private Yw.Geometry.CubicSpline2d _equip_line = null; |
| | | private Yw.Geometry.Point2d _equip_pt = null; |
| | | private List<Tuple<string, Color, double, double, double?, double?>> _equip_sect_pt_list; |
| | | private bool _run_visible = true; |
| | | |
| | | private bool _initial_data = false; |
| | | |
| | |
| | | if (_vm == null) |
| | | return; |
| | | |
| | | if (_equip_line != null && _equip_sect_pt_list != null && _equip_sect_pt_list.Any() && _equip_visible) |
| | | if (_vm.Items!=null&&_vm.Items.Any()&& _run_visible) |
| | | { |
| | | using Pen pen = new(Color.Black, 2); |
| | | pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; |
| | | foreach (var tuple in _equip_sect_pt_list) |
| | | foreach (var vm in _vm.Items) |
| | | { |
| | | var color = tuple.Item2; |
| | | var flow = tuple.Item3; |
| | | var head = tuple.Item4; |
| | | var eff = tuple.Item5; |
| | | var power = tuple.Item6; |
| | | var color = vm.Color; |
| | | var flow = vm.Q; |
| | | var head = vm.H; |
| | | var eff = vm.E; |
| | | var power = vm.P; |
| | | DrawWorkPoint(dxArgs.Cache, color, _axis_y_head, flow, head); |
| | | if (eff.HasValue && _qe_visible) |
| | | DrawWorkPoint(dxArgs.Cache, color, _axis_y_eff, flow, eff.Value); |
| | | if (power.HasValue && _qp_visible) |
| | | DrawWorkPoint(dxArgs.Cache, color, _axis_y_power, flow, power.Value); |
| | | } |
| | | |
| | | DrawEquipLine(dxArgs.Cache, pen, _equip_line); |
| | | |
| | | } |
| | | } |
| | | |
| | | private void DrawEquipLine(GraphicsCache cache, Pen pen, Yw.Geometry.CubicSpline2d qh) |
| | | { |
| | | if (qh == null) |
| | | return; |
| | | var pt_list = qh.GetPointList().ToArray(); |
| | | var pt_f_list = new List<PointF>(); |
| | | foreach (var pt in pt_list) |
| | | { |
| | | var x = pt.X; |
| | | var y = pt.Y; |
| | | var c_pt = _diagram.DiagramToPoint(x, y, _axis_x_flow, _axis_y_head); |
| | | pt_f_list.Add(new PointF(c_pt.Point.X, c_pt.Point.Y)); |
| | | } |
| | | |
| | | using var path = new System.Drawing.Drawing2D.GraphicsPath(); |
| | | path.AddCurve(pt_f_list.ToArray()); |
| | | cache.DrawPath(pen, path); |
| | | } |
| | | |
| | | |
| | | private void DrawWorkPoint(GraphicsCache cache, Color color, AxisYBase axis_y, double x, double y) |
| | | { |
| | |
| | | UpdateChart(true); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置设计点 |
| | | /// </summary> |
| | | public void SetDesignPoint(double x, double y, double? start_head = null) |
| | | { |
| | | _equip_pt = new Geometry.Point2d(x, y); |
| | | _equip_line = null; |
| | | _equip_sect_pt_list = null; |
| | | if (_vm == null) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | start_head ??= _coordinate.DispMinH(); |
| | | |
| | | var equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_vm.CurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d sect_pt); |
| | | if (equip_line == null || sect_pt == null) |
| | | return; |
| | | _equip_line = equip_line; |
| | | _equip_sect_pt_list = new List<Tuple<string, Color, double, double, double?, double?>>(); |
| | | |
| | | double sect_flow = sect_pt.X; |
| | | double sect_head = _vm.CurveQH.GetPointYUnlimited(sect_flow); |
| | | double? sect_eff = null, sect_power = null; |
| | | if (_vm.CurveQP != null) |
| | | { |
| | | sect_power = _vm.CurveQP.GetPointYUnlimited(sect_flow); |
| | | //sect_eff = PumpCalcHelper.CalculateE(sect_flow, sect_head, sect_power.Value); |
| | | } |
| | | if (_vm.CurveQE != null) |
| | | { |
| | | sect_eff = _vm.CurveQE.GetPointYUnlimited(sect_flow); |
| | | // sect_power = PumpCalcHelper.CalculateP(sect_flow, sect_head, sect_eff.Value); |
| | | } |
| | | |
| | | _equip_sect_pt_list.Add(new(_vm.Id, _vm.Color, sect_flow, sect_head, sect_eff, sect_power)); |
| | | if (_vm.Items != null && _vm.Items.Any()) |
| | | { |
| | | foreach (var vm in _vm.Items) |
| | | { |
| | | double flow = 0, head = 0; |
| | | double? eff = null, power = null; |
| | | |
| | | var pump_equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(vm.CurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d pump_sect_pt); |
| | | if (pump_equip_line == null || pump_sect_pt == null) |
| | | return; |
| | | |
| | | flow = pump_sect_pt.X; |
| | | head = vm.CurveQH.GetPointYUnlimited(flow); |
| | | if (vm.CurveQP != null) |
| | | { |
| | | power = vm.CurveQP.GetPointYUnlimited(flow); |
| | | //eff = PumpCalcHelper.CalculateE(flow, head, power.Value); |
| | | } |
| | | if (vm.CurveQE != null) |
| | | { |
| | | eff = vm.CurveQE.GetPointYUnlimited(flow); |
| | | //power = PumpCalcHelper.CalculateP(flow, head, eff.Value); |
| | | } |
| | | |
| | | _equip_sect_pt_list.Add(new(vm.Id, vm.Color, flow, head, eff, power)); |
| | | } |
| | | } |
| | | UpdateChart(true); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 清空曲线 |
| | | /// </summary> |
| | |
| | | |
| | | private void barCekCurveEQVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _equip_visible = this.barCekCurveEQVisible.Checked; |
| | | _run_visible = this.barCekCurveEQVisible.Checked; |
| | | } |
| | | |
| | | #endregion |