using DevExpress.Pdf.Native;
|
using Mapster;
|
using Yw.Model;
|
using Yw.Vmo;
|
|
namespace HStation.WinFrmUI
|
{
|
public partial class SimulationMultiAnalyWorkingDlg : DevExpress.XtraBars.Ribbon.RibbonForm
|
{
|
public SimulationMultiAnalyWorkingDlg()
|
{
|
InitializeComponent();
|
this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
|
this.layoutControl1.SetupLayoutControl();
|
this.hydroWorkingListViewCtrl1.SelectedChangedEvent += HydroWorkingListViewCtrl1_SelectedChangedEvent;
|
}
|
|
private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
|
private List<HydroWorkingVmo> _allWorkingList = null;//所有工况列表
|
private Dictionary<HydroWorkingVmo, SimulationMultiAnalyViewModel> _allCalcuResultDict = null;//计算结果字典
|
|
/// <summary>
|
/// 绑定数据
|
/// </summary>
|
public void SetBindingData
|
(
|
Yw.Model.HydroModelInfo hydroInfo,
|
List<HydroMonitorVmo> allMonitorList,
|
List<HydroWorkingVmo> allWorkingList,
|
HydroNodeInfo node,
|
bool isHead = false,
|
List<HydroEvaluationVmo> allEvaluationList = null
|
)
|
{
|
if (hydroInfo == null)
|
{
|
return;
|
}
|
if (allWorkingList == null || allWorkingList.Count < 1)
|
{
|
return;
|
}
|
if (node == null)
|
{
|
return;
|
}
|
_hydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
|
_allWorkingList = allWorkingList;
|
_allCalcuResultDict = new Dictionary<HydroWorkingVmo, SimulationMultiAnalyViewModel>();
|
foreach (var working in allWorkingList)
|
{
|
_hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
|
var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
|
if (calcuResult.Succeed)
|
{
|
var vm = new SimulationMultiAnalyViewModel();
|
vm.HydroInfo = _hydroInfo;
|
vm.Working = working;
|
vm.Accuracy = HydroAccuracyHelper.Create(_hydroInfo, allMonitorList, working, calcuResult, isHead, allEvaluationList);
|
vm.EnergyAnaly = HydroEnergyAnalyHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList);
|
vm.LossCurve = HydroLossCurveHelper.Create(_hydroInfo, working, node, calcuResult, isHead, allEvaluationList);
|
vm.LossStatistics = HydroLossStatisticsHelper.Create(_hydroInfo, working, calcuResult, isHead, allEvaluationList);
|
_allCalcuResultDict.Add(working, vm);
|
}
|
}
|
if (allWorkingList.Count < 2)
|
{
|
var working = allWorkingList[0];
|
this.Text = $"综合分析({working.Name})";
|
this.groupForWorkingList.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
this.splitter.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
|
this.groupForAnaly.GroupBordersVisible = false;
|
}
|
this.hydroWorkingListViewCtrl1.SetBindingData(allWorkingList);
|
}
|
|
|
//工况选择改变
|
private void HydroWorkingListViewCtrl1_SelectedChangedEvent(HydroWorkingVmo working)
|
{
|
if (working == null)
|
{
|
return;
|
}
|
if (_allCalcuResultDict == null || _allCalcuResultDict.Count < 1)
|
{
|
return;
|
}
|
if (!_allCalcuResultDict.ContainsKey(working))
|
{
|
return;
|
}
|
this.simulationMultiAnalyCtrl1.SetBindingData(_allCalcuResultDict[working]);
|
}
|
|
|
|
|
}
|
}
|