From 4bb44a9c6b32cf299f3103f66d720992ec4a89a2 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期一, 17 二月 2025 21:07:49 +0800 Subject: [PATCH] 增加精度分析 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 173 insertions(+), 2 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs index 3512cd2..e6c4d62 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs @@ -25,6 +25,10 @@ #region 妯″瀷浜嬩欢 /// <summary> + /// 鑾峰彇妯″瀷浜嬩欢 + /// </summary> + public event Func<XhsSchemeVmo, Task<Yw.Model.HydroModelInfo>> GetModelEvent; + /// <summary> /// 鍒锋柊妯″瀷浜嬩欢 /// </summary> public event Func<Task<Yw.Model.HydroModelInfo>> RefreshModelEvent; @@ -1860,7 +1864,7 @@ } } - #endregion 浜哄伐鍒锋柊 + #endregion #region 鐩戞祴鐐� @@ -1899,7 +1903,7 @@ return await helper.GetAnalyseList(); } - #endregion 鐩戞祴鐐� + #endregion #region 鐩戞祴鍊� @@ -2685,8 +2689,154 @@ #region 瀵煎嚭鎶ュ憡 + //鍒涘缓鎵撳嵃淇℃伅 + private async Task<SimulationPrintViewModel> CreatePrintInfo() + { + if (_project == null) + { + return default; + } + if (_hydroInfo == null) + { + return default; + } + + #region 宸ュ喌鍒楄〃 + + var allWorkingList = GetCheckedWorkingList(); + if (allWorkingList == null || allWorkingList.Count < 1) + { + var working = GetWorking(); + if (working == null) + { + TipFormHelper.ShowWarn("璇疯绠楁垨閫夋嫨宸ュ喌鍚庨噸璇曪紒"); + return default; + } + allWorkingList = new List<HydroWorkingVmo>() { working }; + } + + #endregion + + #region 閫夋嫨鑺傜偣 + + var selectedNode = GetSelectNode(); + if (selectedNode == null) + { + return default; + } + + #endregion + + var vm = new SimulationPrintViewModel(); + + #region 椤圭洰 + + vm.Project = new SimulationPrintProjectViewModel(_project); + if (_hydroInfo == null) + { + return vm; + } + + #endregion + + #region 姘存车鍒楄〃 + + vm.PumpList = _hydroInfo.Pumps?.Select(x => + { + var pump = new SimulationPrintPumpViewModel(x); + return pump; + }).ToList(); + + #endregion + + #region 闄勫姞淇℃伅 + + var allMonitorList = await GetMonitorList(); + var allEvaluationList = await GetEvaluationList(); + + #endregion + + #region 鍩虹妯″瀷 + + var baseHydroInfo = _hydroInfo; + if (_scheme != null) + { + baseHydroInfo = await GetModelEvent?.Invoke(null); + } + var baseHydroInfoRhs = baseHydroInfo.Adapt<Yw.Model.HydroModelInfo>(); + + #endregion + + #region 閬嶅巻宸ュ喌 + + vm.WorkingList = new List<SimulationPrintWorkingViewModel>(); + foreach (var working in allWorkingList) + { + baseHydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo); + var calcuResult = baseHydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList); + + var printWorking = new SimulationPrintWorkingViewModel(working); + vm.WorkingList.Add(printWorking); + + //绮惧害璇勪及 + printWorking.Accuracy = SimulationPrintAccuracyHelper.Create(baseHydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //姘存车鍒嗘瀽 + printWorking.PumpAnaly = SimulationPrintPumpAnalyHelper.Create(baseHydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鐩戞祴鍒嗘瀽 + printWorking.MonitorAnaly = SimulationPrintMonitorAnalyHelper.Create(baseHydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鑳借�楀垎鏋� + printWorking.EnergyAnaly = SimulationPrintEnergyAnalyHelper.Create(baseHydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鎹熷け缁熻 + printWorking.LossStatistics = SimulationPrintLossStatisticsHelper.Create(baseHydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鎹熷け鏇茬嚎 + printWorking.LossCurve = SimulationPrintLossCurveHelper.Create(baseHydroInfoRhs, working, selectedNode, calcuResult, _calcuPressModeIsHead, allEvaluationList); + } + + #endregion + + #region 鏂规澶勭悊 + + if (_scheme != null) + { + var hydroInfo = _hydroInfo; + var hydroInfoRhs = hydroInfo.Adapt<Yw.Model.HydroModelInfo>(); + vm.Scheme = new SimulationPrintSchemeViewModel(_scheme); + foreach (var working in allWorkingList) + { + hydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo); + var calcuResult = hydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList); + + var printWorking = new SimulationPrintWorkingViewModel(working); + vm.Scheme.WorkingList.Add(printWorking); + + //绮惧害璇勪及 + printWorking.Accuracy = SimulationPrintAccuracyHelper.Create(hydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //姘存车鍒嗘瀽 + printWorking.PumpAnaly = SimulationPrintPumpAnalyHelper.Create(hydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鐩戞祴鍒嗘瀽 + printWorking.MonitorAnaly = SimulationPrintMonitorAnalyHelper.Create(hydroInfoRhs, allMonitorList, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鑳借�楀垎鏋� + printWorking.EnergyAnaly = SimulationPrintEnergyAnalyHelper.Create(hydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鎹熷け缁熻 + printWorking.LossStatistics = SimulationPrintLossStatisticsHelper.Create(hydroInfoRhs, working, calcuResult, _calcuPressModeIsHead, allEvaluationList); + //鎹熷け鏇茬嚎 + printWorking.LossCurve = SimulationPrintLossCurveHelper.Create(hydroInfoRhs, working, selectedNode, calcuResult, _calcuPressModeIsHead, allEvaluationList); + } + } + + #endregion + + + return vm; + } + + //瀵煎嚭word private async void barBtnExportWord_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { + var printInfo = await CreatePrintInfo(); + var printDlg = new SimulationCommonReportDlg(); + printDlg.SetBindingData(printInfo); + printDlg.ShowDialog(); if (_visual == null) { SelectInputSource(); @@ -2995,6 +3145,27 @@ } } + //鑾峰彇閫夋嫨鑺傜偣 + private HydroNodeInfo GetSelectNode() + { + if (_visual == null) + { + SelectInputSource(); + if (_visual == null) + { + TipFormHelper.ShowWarn("璇烽�夋嫨鏋勪欢鍚庨噸璇曪紒"); + return null; + } + } + HydroVisualInfo visual = _visual; + if (_visual is HydroLinkInfo linkInfo) + { + var visualListHelper = GetVisualListHelper(); + visual = visualListHelper.GetVisual(linkInfo.StartCode); + } + return visual as HydroNodeInfo; + } + //绮惧害璇勪及 private async void barBtnWorkingEvaluation_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { -- Gitblit v1.9.3