lixiaojun
2025-02-17 4bb44a9c6b32cf299f3103f66d720992ec4a89a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using Mapster;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Yw.EPAnet;
using Yw.Hydro;
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    /// <summary>
    /// 损失统计辅助类
    /// </summary>
    public class SimulationPrintLossStatisticsHelper
    {
        /// <summary>
        /// 创建
        /// </summary>
        public static SimulationPrintLossStatisticsViewModel Create
            (
                Yw.Model.HydroModelInfo hydroInfo,
                HydroWorkingVmo working,
                HydroCalcuResult calcuResult = null,
                bool isHead = false,
                List<Yw.Vmo.HydroEvaluationVmo> allEvaluationList = null
            )
        {
            var vm = new SimulationPrintLossStatisticsViewModel();
 
            if (hydroInfo == null)
            {
                return vm;
            }
 
 
            //赋值模型信息,避免干扰
            //var newHydroInfo = hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
            //newHydroInfo.UpdateWorkingInfo(working.WorkingInfo);
 
            //计算结果
            if (calcuResult == null)
            {
                calcuResult = hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
                if (!calcuResult.Succeed)
                {
                    return vm;
                }
            }
            var allCalcuVisualDict = calcuResult.GetVisualDict();
 
            //能量计算
            var network = hydroInfo.ToNetwork();
            var allEnergyList = network.AnalyzeEnergy(calcuResult.EPAnetCalcuResult);
            if (allEnergyList == null || allEnergyList.Count < 1)
            {
                return vm;
            }
 
            //子级集合
            vm.Items = allEnergyList.Select(x => new SimulationPrintLossStatisticsItemViewModel(x)).ToList();
 
            //能量输入
            vm.Input = new SimulationPrintLossStatisticsInputViewModel(hydroInfo, calcuResult, vm.Items);
 
            //分类损失
            vm.Catalog = new SimulationPrintLossStatisticsCatalogViewModel(hydroInfo, calcuResult, vm.Items);
 
            //种类统计
            vm.Category = new SimulationPrintLossStatisticsCategoryViewModel(hydroInfo, calcuResult, vm.Items);
 
            return vm;
        }
 
 
    }
}