using HStation.WinFrmUI.PhartRelation;
|
using SqlSugar;
|
|
namespace HStation.WinFrmUI.Xhs
|
{
|
public partial class SinglePumpAnalyDlg : DevExpress.XtraBars.Ribbon.RibbonForm
|
{
|
public SinglePumpAnalyDlg()
|
{
|
InitializeComponent();
|
this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
|
InitChart();
|
}
|
|
private void InitChart()
|
{
|
this.singlePumpAnalyInfoCtrl1.SetEvent += (id, hz, ex_ratio, qh, qe, qp) =>
|
{
|
this.pumpVariableSpeedChart1.Set(id, hz, ex_ratio, qh, qe, qp);
|
ResetSectPointGrid();
|
};
|
|
this.singlePumpAnalyInfoCtrl1.SetInfoEvent += (id, color) =>
|
{
|
this.pumpVariableSpeedChart1.SetInfo(id, color);
|
ResetSectPointGrid();
|
};
|
|
|
this.singlePumpAnalyInfoCtrl1.SetDesignPointEvent += (q, h) =>
|
{
|
this.pumpVariableSpeedChart1.SetDesignPt(q,h);
|
ResetSectPointGrid();
|
};
|
|
this.pumpVariableSpeedChart1.OnCalcQueryPoint += (id, pt) =>
|
{
|
this.singlePumpAnalyInfoCtrl1.SetQueryInfo(id, pt);
|
};
|
void ResetSectPointGrid()
|
{
|
var vm_list = this.pumpVariableSpeedChart1.GetList();
|
///this.singlePumpAnalyInfoCtrl1.SetSectPoint(vm_list);
|
}
|
}
|
|
public void SetBindindData(PumpMatchingViewModel pump_matching)
|
{
|
InitChartData(pump_matching);
|
}
|
|
private SinglePumpAnalyViewModel _working_vm = null;
|
private async void InitChartData(PumpMatchingViewModel pump_matching)
|
{
|
if (!long.TryParse(pump_matching.DbId, out long pump_main_id))
|
{
|
return;
|
}
|
var pump_main = await new BLL.AssetsPumpMain().GetByID(pump_main_id);
|
if (pump_main == null)
|
{
|
return;
|
}
|
|
var phart_list = await new BLL.XhsPumpMainPhartMappingExtensions().GetByPumpMainID(pump_main_id);
|
if (phart_list == null || !phart_list.Any())
|
{
|
return;
|
}
|
var phart = phart_list.OrderBy(x => x.Importance).First();
|
var diagram = phart.Diagram;
|
if (diagram == null)
|
{
|
return;
|
}
|
var graph_list = diagram.GraphList;
|
if (graph_list == null || !graph_list.Any())
|
{
|
return;
|
}
|
|
var graph_qh = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH);
|
var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE);
|
var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP);
|
if (graph_qh == null)
|
{
|
return;
|
}
|
|
List<Yw.Geometry.Point2d> points_qh = null, points_qe = null, points_qp = null;
|
points_qh = PhartPerformCurveHelper.GetFeatPointList(graph_qh.GraphType, graph_qh.GeometryInfo, 12, null);
|
if (graph_qe != null)
|
points_qe = PhartPerformCurveHelper.GetFeatPointList(graph_qe.GraphType, graph_qe.GeometryInfo, 12, null);
|
if (graph_qp != null)
|
points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null);
|
|
var qh = new Yw.Geometry.CubicSpline2d(points_qh);
|
var qe = new Yw.Geometry.CubicSpline2d(points_qe);
|
var qp = new Yw.Geometry.CubicSpline2d(points_qp);
|
|
|
|
var def_vm = new SinglePumpAnalyViewModel();
|
def_vm.Id = "def";
|
def_vm.Name = "50";
|
def_vm.RatedSpeed = pump_main.RatedSpeed;
|
def_vm.CurrentSpeed = pump_main.RatedSpeed;
|
def_vm.CurrentHz = 50;
|
def_vm.IsDefault = true;
|
def_vm.Color = Color.Black;
|
def_vm.ExtendRatio = 100;
|
def_vm.Qh = qh;
|
def_vm.Qe = qe;
|
def_vm.Qp = qp;
|
def_vm.Calc();
|
//_def_vm.QhCalc = qh;
|
//_def_vm.QeCalc = qe;
|
//_def_vm.QpCalc = qp;
|
|
//_def_vm.SectQ = string.Empty;
|
//_def_vm.SectH = string.Empty;
|
//_def_vm.SectE = string.Empty;
|
//_def_vm.SectP = string.Empty;
|
|
//_def_vm.QueryQ = string.Empty;
|
//_def_vm.QueryH = string.Empty;
|
//_def_vm.QueryE = string.Empty;
|
//_def_vm.QueryP = string.Empty;
|
|
_working_vm = new SinglePumpAnalyViewModel();
|
_working_vm.Id = "working";
|
_working_vm.Name = pump_matching.CurrentHz.ToString();
|
_working_vm.RatedSpeed = pump_main.RatedSpeed;
|
_working_vm.CurrentSpeed = Math.Round(pump_matching.CurrentHz / 50 * pump_main.RatedSpeed, 1);
|
_working_vm.CurrentHz = pump_matching.CurrentHz;
|
_working_vm.IsDefault = false;
|
_working_vm.Color = Color.Red;
|
_working_vm.ExtendRatio = 100;
|
_working_vm.Qh = qh;
|
_working_vm.Qe = qe;
|
_working_vm.Qp = qp;
|
_working_vm.Calc();
|
|
|
var list = new List<SinglePumpAnalyViewModel>() { def_vm, _working_vm };
|
var list_yw = list.Select(x => x.ToInfo()).ToList();
|
|
this.singlePumpAnalyInfoCtrl1.SetBindingData(list);
|
this.pumpVariableSpeedChart1.Add(list_yw);
|
|
}
|
|
|
|
|
}
|
}
|