lixiaojun
2024-12-05 84820e6296602b263633ff9a960bfd15cf0618de
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/01-matching/01-viewmodel/ValveMatchingViewModel.cs
@@ -1,10 +1,47 @@
namespace HStation.WinFrmUI
using HStation.Assets;
namespace HStation.WinFrmUI
{
    /// <summary>
    /// 阀门匹配ViewModel
    /// </summary>
    public class ValveMatchingViewModel
    {
        /// <summary>
        ///
        /// </summary>
        public ValveMatchingViewModel()
        { }
        /// <summary>
        ///
        /// </summary>
        public ValveMatchingViewModel(Yw.Model.HydroValveInfo rhs, Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuVisualResult> allCalcuResult)
        {
            this.ID = rhs.ID;
            this.Name = rhs.Name;
            this.Code = rhs.Code;
            this.ModelType = rhs.ModelType;
            this.DbLocked = rhs.DbLocked;
            this.DbId = rhs.DbId;
            this.CurveDbId = hydroInfo.Curves?.Find(x => x.Code == rhs.ValveSetting)?.DbId;
            this.Material = rhs.Material;
            this.Diameter = rhs.Diameter;
            this.MinorLoss = rhs.MinorLoss;
            switch (rhs.ValveType)
            {
                case Yw.Hydro.ValveType.PRV: this.ValveType = HStation.Assets.eValveType.PRV; break;
                case Yw.Hydro.ValveType.PSV: this.ValveType = HStation.Assets.eValveType.PSV; break;
                case Yw.Hydro.ValveType.PBV: this.ValveType = HStation.Assets.eValveType.PBV; break;
                case Yw.Hydro.ValveType.TCV: this.ValveType = HStation.Assets.eValveType.TCV; break;
                case Yw.Hydro.ValveType.FCV: this.ValveType = HStation.Assets.eValveType.FCV; break;
                case Yw.Hydro.ValveType.GPV: this.ValveType = HStation.Assets.eValveType.GPV; break;
                case Yw.Hydro.ValveType.CV: this.ValveType = HStation.Assets.eValveType.CV; break;
                default: break;
            }
            this.ValveSetting = rhs.ValveSetting;
        }
        /// <summaryd>
        /// ID
        /// </summary>
@@ -48,6 +85,13 @@
        public string DbId { get; set; }
        /// <summary>
        /// CurveDbId
        /// </summary>
        [DisplayName("CurveDbId")]
        [Browsable(false)]
        public string CurveDbId { get; set; }
        /// <summary>
        /// 直径
        /// </summary>
        [DisplayName("直径")]
@@ -73,7 +117,7 @@
        /// </summary>
        [DisplayName("阀门类型")]
        [Browsable(true)]
        public string ValveType { get; set; }
        public HStation.Assets.eValveType ValveType { get; set; }
        /// <summary>
        /// 阀门设置
@@ -104,6 +148,13 @@
        public double? MatchingDiameter { get; set; }
        /// <summary>
        /// MatchingCurveDbId
        /// </summary>
        [DisplayName("MatchingCurveDbId")]
        [Browsable(false)]
        public string MatchingCurveDbId { get; set; }
        /// <summary>
        /// 匹配材质
        /// </summary>
        [DisplayName("匹配材质")]
@@ -122,7 +173,7 @@
        /// </summary>
        [DisplayName("匹配阀门类型")]
        [Browsable(true)]
        public string MatchingValveType { get; set; }
        public HStation.Assets.eValveType? MatchingValveType { get; set; }
        /// <summary>
        /// 匹配阀门设置
@@ -137,5 +188,12 @@
        [DisplayName("匹配水头损失曲线")]
        [Browsable(false)]
        public List<CurvePointMatchingViewModel> MatchingCurveQL { get; set; }
        /// <summary>
        /// 匹配开度损失曲线
        /// </summary>
        [DisplayName("匹配开度损失曲线")]
        [Browsable(false)]
        public List<CurvePointMatchingViewModel> MatchingCurveOL { get; set; }
    }
}