using Castle.Core.Logging;
using Yw.EPAnet;
namespace HStation.WinFrmUI
{
///
/// 能量输入视图
///
public class SimulationPrintLossStatisticsInputViewModel
{
///
///
///
public SimulationPrintLossStatisticsInputViewModel() { }
///
///
///
public SimulationPrintLossStatisticsInputViewModel
(
Yw.Model.HydroModelInfo hydroInfo,
HydroCalcuResult calcuResult,
List allItemList
)
{
if (hydroInfo == null)
{
return;
}
if (calcuResult == null || !calcuResult.Succeed)
{
return;
}
if (allItemList == null || allItemList.Count < 1)
{
return;
}
this.Items = new List();
var itemForInitial = new SimulationPrintLossStatisticsInputItemViewModel();
itemForInitial.Name = "初始势能";
var items = allItemList.Where(x => x.EnergyType == Yw.EPAnet.eEnergyType.Input).ToList();
if (items != null && items.Count > 0)
{
itemForInitial.Value = items.Sum(x => x.EnergyValue);
}
this.Items.Add(itemForInitial);
var itemForPump = new SimulationPrintLossStatisticsInputItemViewModel();
itemForPump.Name = "水泵提升";
if (hydroInfo.Pumps != null && hydroInfo.Pumps.Count > 0)
{
var allCalcuVisualDict = calcuResult.GetVisualDict();
foreach (var pump in hydroInfo.Pumps)
{
var calcuPumpResult = allCalcuVisualDict.GetValue(pump.Code) as HydroCalcuPumpResult;
if (calcuPumpResult != null)
{
if (calcuPumpResult.CalcuP.HasValue)
{
itemForPump.Value += calcuPumpResult.CalcuP.Value * 1000;
}
}
}
}
this.Items.Add(itemForPump);
}
///
/// 子级列表
///
public List Items { get; set; }
}
}