| | |
| | | namespace HStation.WinFrmUI |
| | | using DevExpress.CodeParser; |
| | | using System.Text.Json; |
| | | using Yw.Ahart; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | | public class AssetsMatchingHelper |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | //喷头匹配 |
| | | //冷却塔匹配 |
| | | foreach (var item in assetsAutoMatchingView.Coolings) |
| | | { |
| | | if (Matching(item, allCoolingMain)) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000;//临时修改,之前为1 |
| | | foreach (var item in valveMainVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | { |
| | | input.MatchingMinorLoss = valve.MinorLoss; |
| | | } |
| | | if (input.ValveSetting == null) |
| | | { |
| | | input.MatchingValveSetting = valve.ValveSetting; |
| | | } |
| | | input.MatchingValveType = (Yw.WinFrmUI.eValveType)(int)valve.ValveType; |
| | | if (input.CurveDbId == null) |
| | | { |
| | | var list = Task.Run(async () => |
| | |
| | | { |
| | | var def = list.OrderByDescending(x => x.Importance).First(); |
| | | input.MatchingCurveDbId = def.ID.ToString(); |
| | | var curve = def.Diagram.GraphList[0].GetFeatPointList(); |
| | | if (valve.ValveType == HStation.Assets.eValveType.GPV) |
| | | //var curve = def.Diagram.GraphList[0].GetFeatPointList(); |
| | | //var curve1 = def.Diagram.GraphList[1].GetFeatPointList(); |
| | | //input.MatchingCurveQL = new List<HydroCurvePointViewModel>(); |
| | | /* foreach (var item in curve) |
| | | { |
| | | input.MatchingCurveQL.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | }*/ |
| | | |
| | | input.MatchingCurveOL = new List<HydroCurvePointViewModel>(); |
| | | input.MatchingCurvesQL = new List<HydroFactorCurveViewModel>(); |
| | | for (int i = 0; i < def.Diagram.GraphList.Count; i++) |
| | | { |
| | | input.MatchingCurveQL = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in curve) |
| | | var curve = def.Diagram.GraphList[i].GetFeatPointList(); |
| | | if (def.Diagram.GraphList[i].GraphType == 11) |
| | | { |
| | | input.MatchingCurveQL.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | var opening = Yw.WinFrmUI.PhartGraphHelper.GetGraphParas<Yw.WinFrmUI.Phart.QLGraphParasViewModel>((Yw.Ahart.eCurveType)def.Diagram.GraphList[i].GraphType, def.Diagram.GraphList[i].GraphParas); |
| | | var model = new HydroFactorCurveViewModel(); |
| | | model.CurveFactor = opening.Opening ?? 0; |
| | | model.CurveData = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in curve) |
| | | { |
| | | model.CurveData.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | input.MatchingCurvesQL.Add(model); |
| | | } |
| | | } |
| | | else if (valve.ValveType == HStation.Assets.eValveType.TCV) |
| | | { |
| | | input.MatchingCurveOL = new List<HydroCurvePointViewModel>(); |
| | | foreach (var item in curve) |
| | | else if (def.Diagram.GraphList[i].GraphType == 12) |
| | | { |
| | | input.MatchingCurveOL.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | foreach (var item in curve) |
| | | { |
| | | input.MatchingCurveOL.Add(new HydroCurvePointViewModel(item.X, item.Y)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | return true; |
| | | return false; |
| | | } |
| | | |
| | | //管道匹配 |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in pipeLineMainVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in threelinkVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in fourLinkVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in sprinklerVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in allExchangerList) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in allCompressorList) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in bluntheadVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in tankVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 10; |
| | | int flagWeight = 1000; |
| | | foreach (var item in allMeterList) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 10; |
| | | int flagWeight = 1000; |
| | | foreach (var item in allFlowmeterList) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in hydrantVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | allElbowList = allElbowList.Where(x => x.Angle == 90).ToList(); |
| | | //权重字典 |
| | | var dict = new Dictionary<AssetsElbowMainVmo, double>(); |
| | | foreach (var item in allElbowList) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //口径 |
| | | int caliberWeight = 1; |
| | | if (input.Caliber > 0) |
| | | { |
| | | foreach (var item in allElbowList) |
| | | { |
| | | if (item.Caliber.HasValue) |
| | | { |
| | | var diff = Math.Abs(item.Caliber.Value - input.Caliber); |
| | | dict[item] += diff / input.Caliber * 100 * caliberWeight; |
| | | } |
| | | } |
| | | } |
| | | // 角度 |
| | | int angleWeight = 1000; |
| | | if (input.BendingAngle > 0) |
| | | { |
| | | foreach (var item in allElbowList) |
| | | { |
| | | if (item.Angle > 0) |
| | | { |
| | | var count = Math.Abs(item.Angle.Value - input.BendingAngle); |
| | | if (count != 0) |
| | | { |
| | | dict[item] += (1.0 / count) * angleWeight; |
| | | } |
| | | else |
| | | { |
| | | // 如果 count 为 0,表示完全匹配,给予最大权重 |
| | | dict[item] += angleWeight * 100; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 关键字 |
| | | int keywordWeight = 1; |
| | | foreach (var item in allElbowList) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 10; |
| | | int flagWeight = 1000; |
| | | foreach (var item in allElbowList) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | { |
| | | input.MatchingBendingAngle = elbow.Angle; |
| | | } |
| | | input.MatchingElbowType = (Yw.WinFrmUI.eElbowType)(int)elbow.ElbowType; |
| | | if (elbow.ElbowType != null) |
| | | { |
| | | input.MatchingElbowType = (Yw.WinFrmUI.eElbowType)(int)elbow.ElbowType; |
| | | } |
| | | if (input.Material == null || input.Material == string.Empty) |
| | | { |
| | | input.MatchingMaterial = elbow.Material; |
| | |
| | | public static bool Matching(HydroPressmeterMatchingViewModel input, List<AssetsPressmeterMainVmo> pressmeterVmos) |
| | | { |
| | | //输入参数验证 |
| | | |
| | | if (input == null) |
| | | { |
| | | return false; |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in pressmeterVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | } |
| | | } |
| | | |
| | | // 上游和下游直径 |
| | | int diameterWeight = 100; |
| | | if (input.StartDiameter > 0 && input.EndDiameter > 0) |
| | | { |
| | | foreach (var item in translationVmos) |
| | | { |
| | | if (item.StartDiameter > 0 && item.EndDiameter > 0) |
| | | { |
| | | var startCount = Math.Abs(item.StartDiameter - input.StartDiameter); |
| | | var endCount = Math.Abs(item.EndDiameter - input.EndDiameter); |
| | | |
| | | if (startCount == 0 && endCount == 0) |
| | | { |
| | | // 如果 startCount 和 endCount 都为 0,表示完全匹配,给予最大权重 |
| | | dict[item] += diameterWeight * 100; |
| | | } |
| | | else |
| | | { |
| | | // 否则,分别计算权重 |
| | | if (startCount != 0) |
| | | { |
| | | dict[item] += (1.0 / startCount) * diameterWeight; |
| | | } |
| | | if (endCount != 0) |
| | | { |
| | | dict[item] += (1.0 / endCount) * diameterWeight; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //材质 |
| | | int materialWeight = 5; |
| | | if (!string.IsNullOrEmpty(input.Material)) |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in translationVmos) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |
| | |
| | | { |
| | | input.MatchingMaterial = translation.Material; |
| | | } |
| | | if (input.MinorLoss < 0) |
| | | if (input.MinorLoss <= 0) |
| | | { |
| | | input.MatchingMinorLoss = translation.MinorLoss; |
| | | } |
| | | if (input.Roughness < 0) |
| | | if (input.Roughness <= 0) |
| | | { |
| | | input.MatchingRoughness = translation.Roughness; |
| | | } |
| | |
| | | { |
| | | input.MatchingStartDiameter = translation.StartDiameter; |
| | | } |
| | | input.MatchingTranslationType = (Yw.WinFrmUI.eTranslationType)(int)translation.TranslationType; |
| | | |
| | | return true; |
| | | } |
| | |
| | | } |
| | | |
| | | //标签 |
| | | int flagWeight = 1; |
| | | int flagWeight = 1000; |
| | | foreach (var item in allCoolingList) |
| | | { |
| | | if (item.Flags != null && item.Flags.Count > 0) |