| | |
| | | global using Yw.EPAnet; |
| | | using DevExpress.CodeParser; |
| | | using DevExpress.Diagram.Core.Native; |
| | | using DevExpress.Mvvm.Native; |
| | | using DevExpress.Office.Utils; |
| | | using DevExpress.PivotGrid.QueryMode.TuplesTree; |
| | | using DevExpress.Utils.Extensions; |
| | | using DevExpress.Xpo.Helpers; |
| | | using DevExpress.XtraBars.Ribbon; |
| | | using DevExpress.XtraRichEdit.Layout; |
| | | using DevExpress.XtraSpreadsheet.Commands; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using NetTaste; |
| | | using NPOI.SS.Formula.Functions; |
| | | using System.Diagnostics; |
| | | using System.Windows.Media; |
| | |
| | | ShowBimfaceCtrl(); |
| | | ShowQ3dCtrl(); |
| | | ShowPropertyCtrl(); |
| | | } |
| | | |
| | | private void InitialUI() |
| | | { |
| | | InitialCurrentWorking(); |
| | | } |
| | | |
| | | |
| | | #region Bimface |
| | | #region BIM控件 |
| | | |
| | | //bimface控件 |
| | | private XhsProjectSimulationBimfaceCtrl _bimfaceCtrl = null; |
| | |
| | | { |
| | | _bimfaceCtrl = new XhsProjectSimulationBimfaceCtrl(); |
| | | _bimfaceCtrl.Dock = DockStyle.Fill; |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite, () => _hydroInfo); |
| | | await _bimfaceCtrl.InitialData(_project, _projectSite); |
| | | _bimfaceCtrl.LoadCompletedEvent += () => |
| | | {//view加载完成事件 |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | InitialUI(); |
| | | }; |
| | | _bimfaceCtrl.HydroMouseLeftClickEvent += (obj) => |
| | | {//鼠标左键点击事件 |
| | |
| | | { |
| | | return; |
| | | } |
| | | _selectedVisual = obj; |
| | | //_selectedVisual = obj; |
| | | ShowSelectedProperty(); |
| | | }; |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region Q3d |
| | | #region Q3d控件 |
| | | |
| | | //Q3d 控件 |
| | | private XhsProjectSimulationQ3dCtrl _q3dCtrl = null; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 可见视图列表 |
| | | #region 视图列表 |
| | | |
| | | //所有可见视图字典 |
| | | private Dictionary<string, HydroVisualViewModel> _allVisualViewModelDict = null; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 未匹配列表 |
| | | #region 未匹列表 |
| | | |
| | | //获取未匹配列表控件 |
| | | private XhsProjectSimulationUnMatchingListCtrl GetUnMatchingListCtrl() |
| | |
| | | this.barBtnSetValveList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 并联分析 |
| | | |
| | | //并联分析 |
| | | private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | if (!pump.RatedN.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; |
| | | var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; |
| | | var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; |
| | | if (qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | |
| | | var vm = new XhsSinglePumpViewModel(); |
| | | vmList.Add(vm); |
| | | vm.ID = pump.ID; |
| | | vm.Name = pump.Name; |
| | | vm.Code = pump.Code; |
| | | vm.IsBp = true; |
| | | vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; |
| | | vm.RatedHz = pump.RatedHz; |
| | | vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); |
| | | vm.RatedSpeed = pump.RatedN.Value; |
| | | vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio); |
| | | vm.CurveQH = qhPtList; |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuFlow.HasValue) |
| | | { |
| | | vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value); |
| | | } |
| | | |
| | | var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | if (calcuResultStart != null && calcuResultEnd != null) |
| | | { |
| | | if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue) |
| | | { |
| | | vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | var dlg = new PumpParallelAnalyDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | list?.ForEach(x => |
| | | { |
| | | var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code); |
| | | if (pump != null) |
| | | { |
| | | pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; |
| | | pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); |
| | | } |
| | | }); |
| | | ShowSelectedProperty(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 构件明细控件 |
| | | #region 构件控件 |
| | | |
| | | //构件明细控件 |
| | | private Yw.WinFrmUI.HydroVisualListCtrl _visualListCtrl = null; |
| | |
| | | |
| | | #region 监测列表 |
| | | |
| | | #region 测点列表 |
| | | |
| | | //所有监测点列表 |
| | | //所有监测列表 |
| | | private List<HydroMonitorVmo> _allMonitorList = null; |
| | | |
| | | //获取监测点列表 |
| | | //获取监测列表 |
| | | private async Task<List<HydroMonitorVmo>> GetMonitorList() |
| | | { |
| | | if (_hydroInfo == null) |
| | |
| | | return _allMonitorList; |
| | | } |
| | | |
| | | //更新监测点列表 |
| | | //更新监测列表 |
| | | private async void UpdateMonitorList(string code) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 监测列表 |
| | | |
| | | |
| | | |
| | | #region 监测值列表 |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 导出INP文件 |
| | | #region 导出INP |
| | | |
| | | //导出INP文件 |
| | | private void barBtnExportInp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | |
| | | |
| | | #region 工况计算 |
| | | |
| | | //所有工况列表 |
| | | private List<HydroWorkingVmo> _allWorkingList = null; |
| | | |
| | | //获取工况列表 |
| | | private async Task<List<HydroWorkingVmo>> GetWorkingList() |
| | | { |
| | | if (_allWorkingList == null) |
| | | { |
| | | _allWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allWorkingList == null) |
| | | { |
| | | _allWorkingList = new List<HydroWorkingVmo>(); |
| | | } |
| | | } |
| | | return _allWorkingList; |
| | | } |
| | | |
| | | //所有工况元组列表 |
| | | private List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>> _allWorkingTupleList = new List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>>(); |
| | | private List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>> _allWorkingTupleList = null; |
| | | |
| | | //获取工况元组列表 |
| | | private async Task<List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>>> GetWorkingTupleList() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | if (_allWorkingTupleList == null) |
| | | { |
| | | _allWorkingTupleList = new List<Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>>(); |
| | | var allWorkingList = await GetWorkingList(); |
| | | if (allWorkingList.Count > 0) |
| | | { |
| | | allWorkingList.ForEach(x => |
| | | { |
| | | var checkResult = _hydroInfo.Check(); |
| | | HydroCalcuResult calcuResult = null; |
| | | if (checkResult != null && checkResult.Succeed) |
| | | { |
| | | calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss); |
| | | } |
| | | _allWorkingTupleList.Add(new Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>(x, checkResult, calcuResult)); |
| | | }); |
| | | } |
| | | } |
| | | return _allWorkingTupleList; |
| | | } |
| | | |
| | | //添加工况元组 |
| | | private async void AppendWorkingTuple(HydroWorkingVmo working, HydroCheckResult check, HydroCalcuResult calcu) |
| | | { |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | allWorkingTupleList.Add(new Tuple<HydroWorkingVmo, HydroCheckResult, HydroCalcuResult>(working, check, calcu)); |
| | | } |
| | | |
| | | //移除工况元组 |
| | | private async void RemoveWorkingTuple(HydroWorkingVmo working) |
| | | { |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | if (allWorkingTupleList.Count > 0) |
| | | { |
| | | allWorkingTupleList.RemoveAll(x => x.Item1.ID == working.ID); |
| | | } |
| | | } |
| | | |
| | | //显示工况计算窗体 |
| | | private void ShowWorkingCalcuDlg() |
| | |
| | | { |
| | | return; |
| | | } |
| | | var allWorkingList = await GetWorkingList(); |
| | | var vmo = new HydroWorkingVmo(); |
| | | vmo.ModelID = _hydroInfo.ID; |
| | | vmo.Name = working.Name; |
| | | vmo.WorkingInfo = JsonHelper.Object2Json(working.WorkingInfo); |
| | | vmo.MonitorInfo = JsonHelper.Object2Json(working.MonitorInfo); |
| | | vmo.SortCode = _allWorkingList.Count < 1 ? 1 : _allWorkingList.Max(x => x.SortCode) + 1; |
| | | vmo.SortCode = allWorkingList.Count < 1 ? 1 : allWorkingList.Max(x => x.SortCode) + 1; |
| | | vmo.Description = working.Description; |
| | | vmo.ID = await BLLFactory<Yw.BLL.HydroWorking>.Instance.Insert(vmo); |
| | | if (vmo.ID < 1) |
| | |
| | | TipFormHelper.ShowError("创建工况失败,计算取消!"); |
| | | return; |
| | | } |
| | | _allWorkingList.Add(vmo); |
| | | allWorkingList.Add(vmo); |
| | | |
| | | _hydroInfo.UpdateWorkingInfo(working.WorkingInfo); |
| | | //校验 |
| | |
| | | UpdateVisualViewModelCalcuProperty(); |
| | | UpdateVisualListCtrl(); |
| | | UpdateSelectedProperty(); |
| | | await _bimfaceCtrl?.SetLogicCalcuCustomLabelsCalcuResult(_calcuResult); |
| | | //await _bimfaceCtrl?.SetLogicCalcuCustomLabelsCalcuResult(_calcuResult); |
| | | TipFormHelper.ShowSucceed("计算成功!"); |
| | | var codes = _hydroInfo.Pumps.Select(x => x.Code).ToList(); |
| | | await _bimfaceCtrl?.ZoomAndSelectComponents(codes); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 计算标签 |
| | | |
| | | //计算标签是否显示 |
| | | private bool _isCalcuLabelsVisible = false; |
| | | |
| | | //所有计算标签 |
| | | private List<LogicCalcuCustomLabel> _allCalcuLabels = null; |
| | | |
| | | //获取计算标签 |
| | | private List<LogicCalcuCustomLabel> GetCalcuLabels() |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return default; |
| | | } |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | if (allCalcuResultList == null || allCalcuResultList.Count < 1) |
| | | { |
| | | return default; |
| | | } |
| | | var list = new List<LogicCalcuCustomLabel>(); |
| | | |
| | | _hydroInfo.Pumps?.ForEach(x => |
| | | { |
| | | var hz = Math.Round(x.RatedHz * x.SpeedRatio); |
| | | var calcuPumpResult = GetCalcuVisualResult(x.Code) as HydroCalcuLinkResult; |
| | | if (calcuPumpResult != null) |
| | | { |
| | | var calcuPumpStartResult = GetCalcuVisualResult(x.StartCode) as HydroCalcuNodeResult; |
| | | var calcuPumpEndResult = GetCalcuVisualResult(x.EndCode) as HydroCalcuNodeResult; |
| | | var pumpCustomLabel = new LogicCalcuCustomLabel(); |
| | | pumpCustomLabel.Id = x.Code; |
| | | pumpCustomLabel.Distance = 20000; |
| | | pumpCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() |
| | | { |
| | | new LogicCalcuCustomLabelItem(){ Name="状态",Value=HydroLinkStatusHelper.GetStatusName(x.LinkStatus),Unit=string.Empty}, |
| | | new LogicCalcuCustomLabelItem(){ Name="频率",Value=hz.ToString(),Unit=string.Empty}, |
| | | new LogicCalcuCustomLabelItem(){ Name="流量",Value=Math.Round(calcuPumpResult.CalcuFlow.Value,1).ToString(),Unit="m³/h"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="进口压力",Value=Math.Round(calcuPumpStartResult.CalcuHead.Value,4).ToString(),Unit="m"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="出口压力",Value=Math.Round(calcuPumpEndResult.CalcuHead.Value,4).ToString(),Unit="m"}, |
| | | }; |
| | | list.Add(pumpCustomLabel); |
| | | } |
| | | }); |
| | | |
| | | _hydroInfo.GetAllEmitters()?.ForEach(x => |
| | | { |
| | | var calcuEmitter = GetCalcuVisualResult(x.Code) as HydroCalcuNodeResult; |
| | | var emitterCustomLabel = new LogicCalcuCustomLabel(); |
| | | emitterCustomLabel.Id = x.Code; |
| | | emitterCustomLabel.Distance = 30000; |
| | | emitterCustomLabel.Data = new List<LogicCalcuCustomLabelItem>() |
| | | { |
| | | new LogicCalcuCustomLabelItem(){ Name="流量",Value=Math.Round(calcuEmitter.CalcuDemand.Value,1).ToString(),Unit="m³/h"}, |
| | | new LogicCalcuCustomLabelItem(){ Name="压力",Value=Math.Round(calcuEmitter.CalcuDemand.Value,4).ToString(),Unit="m"} |
| | | }; |
| | | list.Add(emitterCustomLabel); |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //设置计算标签 |
| | | private void SetCalcuLabels() |
| | | { |
| | | if (_isCalcuLabelsVisible) |
| | | { |
| | | var allCalcuLabels = GetCalcuLabels(); |
| | | _bimfaceCtrl?.SetLogicCalcuCustomLabels(allCalcuLabels); |
| | | } |
| | | else |
| | | { |
| | | _bimfaceCtrl?.ClearLogicCalcuCustomLabels(); |
| | | } |
| | | } |
| | | |
| | | //设置计算标签是否显示 |
| | | private void barCkCalcuLabels_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | _isCalcuLabelsVisible = this.barCkCalcuLabels.Checked; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 当前工况 |
| | | |
| | | //当前工况 |
| | | private Yw.Vmo.HydroWorkingVmo _currentWorking = null; |
| | | |
| | | //初始化当前工况 |
| | | private void InitialCurrentWorking(List<HydroWorkingVmo> allWorkingList) |
| | | private async void InitialCurrentWorking() |
| | | { |
| | | var allWorkingList = await GetWorkingList(); |
| | | this.repositoryItemImageComboBox1.Items.BeginUpdate(); |
| | | this.repositoryItemImageComboBox1.Items.Clear(); |
| | | if (allWorkingList != null && allWorkingList.Count > 0) |
| | |
| | | } |
| | | |
| | | //设置当前工况 |
| | | private void SetCurrentWorking(HydroWorkingVmo working) |
| | | private async void SetCurrentWorking(HydroWorkingVmo working) |
| | | { |
| | | if (working == null) |
| | | { |
| | | return; |
| | | } |
| | | this.barEditCurrentWorking.EditValue = working; |
| | | _currentWorking = working; |
| | | var allWorkingTupleList = await GetWorkingTupleList(); |
| | | var tuple = allWorkingTupleList?.Find(x => x.Item1.ID == working.ID); |
| | | if (tuple == null) |
| | | { |
| | | return; |
| | | } |
| | | _checkResult = tuple.Item2; |
| | | _calcuResult = tuple.Item3; |
| | | } |
| | | |
| | | //当前工况发生改变 |
| | |
| | | { |
| | | var working = this.barEditCurrentWorking.EditValue as HydroWorkingVmo; |
| | | SetCurrentWorking(working); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 工况列表 |
| | | |
| | | //所有工况列表 |
| | | private List<HydroWorkingVmo> _allWorkingList = null; |
| | | |
| | | //初始化工况列表 |
| | | private async void InitialWorkingList() |
| | | { |
| | | _allWorkingList = await BLLFactory<Yw.BLL.HydroWorking>.Instance.GetByModelID(_hydroInfo.ID); |
| | | if (_allWorkingList == null) |
| | | { |
| | | _allWorkingList = new List<HydroWorkingVmo>(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | ////获取属性控件 |
| | | //private XhsProjectSimulationPropertyCtrl GetPropertyCtrl() |
| | | //{ |
| | | // if (_propertyCtrl == null) |
| | | // { |
| | | // _propertyCtrl = new XhsProjectSimulationPropertyCtrl(); |
| | | // _propertyCtrl.Dock = DockStyle.Fill; |
| | | // _propertyCtrl.HydroViewEvent += (visual) => |
| | | // { |
| | | // if (visual == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // _bimfaceCtrl?.ZoomToComponent(visual.Code); |
| | | // }; |
| | | // _propertyCtrl.BlinkLinkNodeEvent += async (link, linkNodeCode) => |
| | | // { //强调连接节点 |
| | | // if (_hydroInfo == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (link == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (string.IsNullOrEmpty(linkNodeCode)) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var linkNode = GetVisual(linkNodeCode); |
| | | // if (linkNode == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var blinkCodes = new List<string>(); |
| | | // if (linkNode.GetType() == typeof(HydroJunctionInfo)) |
| | | // { |
| | | // var allLinkList = GetLinkList(); |
| | | // if (allLinkList == null || allLinkList.Count < 1) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var linkList = allLinkList.Where(x => (x.StartCode == linkNodeCode || x.EndCode == linkNodeCode) && x.Code != linkNodeCode).ToList(); |
| | | // if (linkList == null || linkList.Count < 1) |
| | | // { |
| | | // return; |
| | | // } |
| | | // blinkCodes.AddRange(linkList.Select(x => x.Code)); |
| | | // } |
| | | // else |
| | | // { |
| | | // blinkCodes.Add(linkNodeCode); |
| | | // } |
| | | |
| | | // await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | // await _bimfaceCtrl?.SetBlinkComponents(blinkCodes); |
| | | // await Task.Delay(5000); |
| | | // await _bimfaceCtrl?.ClearBlinkComponents(); |
| | | // }; |
| | | // _propertyCtrl.PropertyValueChangedEvent += (visual) => |
| | | // { |
| | | // if (visual == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // UpdateVisualListCtrl(); |
| | | // //ApplyGradingResultList(visual); |
| | | // }; |
| | | // _propertyCtrl.MarkPropertyValueChangedEvent += (visual) => |
| | | // { |
| | | // //标注属性发生改变 |
| | | // //判断当前是否有标注展示,若有则更新标注,最好是更新单个标注 |
| | | // //UpdateMark(visual); |
| | | // }; |
| | | // _propertyCtrl.GradingPropertyValueChangedEvent += (parter) => |
| | | // { |
| | | // //分级属性发生改变 |
| | | // //判断当前是否有分级展示,若有则更新分级,最好是更新单个分级 |
| | | // }; |
| | | // _propertyCtrl.FlowEffectPropertyValueChangedEvent += (visual) => |
| | | // { |
| | | // //流向属性发生改变 |
| | | // //判断流向是否加载,如果加载则更新流向,最好是更新单个流向 |
| | | // //UpdateFlowEffect(visual); |
| | | // }; |
| | | |
| | | // } |
| | | // return _propertyCtrl; |
| | | //} |
| | | |
| | | ////属性控件是否可见 |
| | | //private bool IsPropertyCtrlVisible |
| | | //{ |
| | | // get |
| | | // { |
| | | // if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | // { |
| | | // if (this.controlContainerRight.Controls.Count > 0) |
| | | // { |
| | | // if (this.controlContainerRight.Controls[0] is XhsProjectSimulationPropertyCtrl) |
| | | // { |
| | | // return true; |
| | | // } |
| | | // } |
| | | // } |
| | | // return false; |
| | | // } |
| | | //} |
| | | |
| | | ////显示属性控件 |
| | | //private void ShowPropertyCtrl() |
| | | //{ |
| | | // if (IsPropertyCtrlVisible) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var propertyCtrl = GetPropertyCtrl(); |
| | | // this.controlContainerRight.Controls.Clear(); |
| | | // this.controlContainerRight.Controls.Add(propertyCtrl); |
| | | // this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | // this.docPnlRight.Text = "属性"; |
| | | // this.docPnlRight.Width = 300; |
| | | //} |
| | | |
| | | private void barBtnWorkingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | private HydroWorkingTreeCtrl _workingCtrl = null; |
| | | |
| | | //获取工况控件 |
| | | private HydroWorkingTreeCtrl GetWorkingCtrl() |
| | | private async Task<HydroWorkingTreeCtrl> GetWorkingCtrl() |
| | | { |
| | | if (_workingCtrl == null) |
| | | { |
| | | _workingCtrl = new HydroWorkingTreeCtrl(); |
| | | _workingCtrl.Dock = DockStyle.Fill; |
| | | var allWorkingList = await GetWorkingList(); |
| | | _workingCtrl.SetBindingData(allWorkingList); |
| | | _workingCtrl.FocusedChangedEvent += (vmo) => |
| | | { |
| | | |
| | | }; |
| | | } |
| | | return _workingCtrl; |
| | | } |
| | | |
| | | //工况控件是否可见 |
| | | private bool IsWorkingCtrlVisible |
| | | { |
| | | get |
| | | { |
| | | if (this.docPnlRight.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible) |
| | | { |
| | | if (this.controlContainerRight.Controls.Count > 0) |
| | | { |
| | | if (this.controlContainerRight.Controls[0] is HydroWorkingTreeCtrl) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //显示工况控件 |
| | | private async void ShowWorkingCtrl() |
| | | { |
| | | if (IsWorkingCtrlVisible) |
| | | { |
| | | return; |
| | | } |
| | | var workingCtrl = await GetWorkingCtrl(); |
| | | this.controlContainerRight.Controls.Clear(); |
| | | this.controlContainerRight.Controls.Add(workingCtrl); |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; |
| | | this.docPnlRight.Text = "工况"; |
| | | this.docPnlRight.Width = 300; |
| | | } |
| | | |
| | | //隐藏工况控件 |
| | | private void HideWorkingCtrl() |
| | | { |
| | | if (IsWorkingCtrlVisible) |
| | | { |
| | | this.docPnlRight.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Hidden; |
| | | } |
| | | } |
| | | |
| | | //更新工况控件 |
| | | private async void UpdateWorkingCtrl() |
| | | { |
| | | var workingCtrl = await GetWorkingCtrl(); |
| | | var allWorkingList = await GetWorkingList(); |
| | | workingCtrl.SetBindingData(allWorkingList); |
| | | } |
| | | |
| | | //工况列表点击 |
| | | private void barBtnWorkingList_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | ShowWorkingCtrl(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况评估 |
| | | |
| | | |
| | | private void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况并联 |
| | | |
| | | //并联分析 |
| | | private void barBtnAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (_hydroInfo.Pumps == null || _hydroInfo.Pumps.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | | var allCalcuResultList = GetCalcuVisualResultList(Yw.EPAnet.CalcuMode.MinorLoss, false); |
| | | var vmList = new List<XhsSinglePumpViewModel>(); |
| | | foreach (var pump in _hydroInfo.Pumps) |
| | | { |
| | | if (!pump.RatedN.HasValue) |
| | | { |
| | | continue; |
| | | } |
| | | var qh = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQH)?.CurveData; |
| | | var qe = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQE)?.CurveData; |
| | | var qp = _hydroInfo.Curves?.Find(t => t.Code == pump.CurveQP)?.CurveData; |
| | | if (qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | var qhPtList = qh.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qePtList = qe?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | var qpPtList = qp?.Select(x => new XhsSplinePointViewModel(x.X, x.Y)).ToList(); |
| | | |
| | | var vm = new XhsSinglePumpViewModel(); |
| | | vmList.Add(vm); |
| | | vm.ID = pump.ID; |
| | | vm.Name = pump.Name; |
| | | vm.Code = pump.Code; |
| | | vm.IsBp = true; |
| | | vm.RunStatus = pump.LinkStatus == Yw.Hydro.LinkStatus.Open; |
| | | vm.RatedHz = pump.RatedHz; |
| | | vm.CurrentHz = Math.Round(pump.RatedHz * pump.SpeedRatio, 1); |
| | | vm.RatedSpeed = pump.RatedN.Value; |
| | | vm.CurrentSpeed = Math.Round(pump.RatedN.Value * pump.SpeedRatio); |
| | | vm.CurveQH = qhPtList; |
| | | vm.CurveQE = qePtList; |
| | | vm.CurveQP = qpPtList; |
| | | |
| | | if (allCalcuResultList != null && allCalcuResultList.Count > 0) |
| | | { |
| | | var calcuResult = allCalcuResultList.Find(x => x.Code == pump.Code) as HydroCalcuLinkResult; |
| | | if (calcuResult != null) |
| | | { |
| | | if (calcuResult.CalcuFlow.HasValue) |
| | | { |
| | | vm.CalcuQ = Math.Abs(calcuResult.CalcuFlow.Value); |
| | | } |
| | | |
| | | var calcuResultStart = allCalcuResultList.Find(x => x.Code == pump.StartCode) as HydroCalcuNodeResult; |
| | | var calcuResultEnd = allCalcuResultList.Find(x => x.Code == pump.EndCode) as HydroCalcuNodeResult; |
| | | if (calcuResultStart != null && calcuResultEnd != null) |
| | | { |
| | | if (calcuResultStart.CalcuHead.HasValue && calcuResultEnd.CalcuHead.HasValue) |
| | | { |
| | | vm.CalcuH = Math.Round(Math.Abs(calcuResultStart.CalcuHead.Value - calcuResultEnd.CalcuHead.Value), 4); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | var dlg = new PumpParallelAnalyDlg(); |
| | | dlg.SetBindingData(vmList); |
| | | dlg.ReloadDataEvent += (list) => |
| | | { |
| | | list?.ForEach(x => |
| | | { |
| | | var pump = _hydroInfo.Pumps?.Find(t => t.Code == x.Code); |
| | | if (pump != null) |
| | | { |
| | | pump.LinkStatus = x.RunStatus ? Yw.Hydro.PumpStatus.Open : Yw.Hydro.PumpStatus.Closed; |
| | | pump.SpeedRatio = Math.Round(x.CurrentHz / pump.RatedHz, 1); |
| | | } |
| | | }); |
| | | ShowSelectedProperty(); |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 工况能效 |
| | | |
| | | private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 损失曲线 |
| | | |
| | | private void barBtnWorkingLossCurve_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 损失比例 |
| | | |
| | | private void barBtnWorkingLossScale_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 综合分析 |
| | | private void barBtnWorkingAnaly_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | XtraMessageBox.Show("正在开发中,敬请期待!"); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |