Yw.Epanet.Calcu.Core/00-core/Catalog.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Epanet.Calcu.Core/00-core/PumpStatus.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Epanet.Calcu.Core/00-core/ValveStatus.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Epanet.Calcu.Core/00-core/ValveType.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Epanet.Calcu.Core/04-Inp/InpGenerater.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Epanet.Calcu.Core/06-calcu/00-core/NetworkCalcuExtensions.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Epanet.Calcu.Core/Properties/PublishProfiles/FolderProfile.pubxml.user | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Epanet.Calcu.Core/Yw.Epanet.Calcu.Core.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Yw.Hydraulic.Test.Core/Program.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Yw.Epanet.Calcu.Core/00-core/Catalog.cs
@@ -8,167 +8,177 @@ /// <summary> /// 组件 /// </summary> public const string Parter = "Parter"; public const string Parter = "parter"; /// <summary> /// 可见组件 /// </summary> public const string Visual = "Visual"; public const string Visual = "visual"; /// <summary> /// 节点 /// </summary> public const string Node = "Node"; public const string Node = "node"; /// <summary> /// 水源 /// </summary> public const string Source = "Source"; public const string Source = "source"; /// <summary> /// 水库 /// </summary> public const string Reservoir = "Reservoir"; public const string Reservoir = "reservoir"; /// <summary> /// 水池 /// </summary> public const string Tank = "Tank"; public const string Tank = "tank"; /// <summary> /// 水箱 /// </summary> public const string Waterbox = "Waterbox"; public const string Waterbox = "waterbox"; /// <summary> /// 连接节点 /// </summary> public const string Junction = "Junction"; public const string Junction = "junction"; /// <summary> /// 虚拟连接节点 /// </summary> public const string Vunction = "vunction"; /// <summary> /// 连接件 /// </summary> public const string Coupling = "Coupling"; public const string Coupling = "coupling"; /// <summary> /// 闷头 /// </summary> public const string Blunthead = "Blunthead"; public const string Blunthead = "blunthead"; /// <summary> /// 弯头 /// </summary> public const string Elbow = "Elbow"; public const string Elbow = "elbow"; /// <summary> /// 三通 /// </summary> public const string Threelink = "Threelink"; public const string Threelink = "threelink"; /// <summary> /// 四通 /// </summary> public const string Fourlink = "Fourlink"; public const string Fourlink = "fourlink"; /// <summary> /// 扩散器 /// </summary> public const string Emitter = "Emitter"; public const string Emitter = "emitter"; /// <summary> /// 喷嘴 /// </summary> public const string Nozzle = "Nozzle"; public const string Nozzle = "nozzle"; /// <summary> /// 消火栓 /// </summary> public const string Hydrant = "Hydrant"; public const string Hydrant = "hydrant"; /// <summary> /// 冷却塔 /// </summary> public const string Cooling = "Cooling"; public const string Cooling = "cooling"; /// <summary> /// 水表 /// </summary> public const string Meter = "Meter"; public const string Meter = "meter"; /// <summary> /// 仪表 /// </summary> public const string Instrument = "Instrument"; public const string Instrument = "instrument"; /// <summary> /// 流量计 /// </summary> public const string Flowmeter = "Flowmeter"; public const string Flowmeter = "flowmeter"; /// <summary> /// 压力表 /// </summary> public const string Pressmeter = "Pressmeter"; public const string Pressmeter = "pressmeter"; /// <summary> /// 管段 /// </summary> public const string Link = "Link"; public const string Link = "link"; /// <summary> /// 管道 /// </summary> public const string Pipe = "Pipe"; public const string Pipe = "pipe"; /// <summary> /// 虚拟管道 /// </summary> public const string Vipe = "vipe"; /// <summary> /// 过渡件 /// </summary> public const string Translation = "Translation"; public const string Translation = "translation"; /// <summary> /// 水泵 /// </summary> public const string Pump = "Pump"; public const string Pump = "pump"; /// <summary> /// 阀门 /// </summary> public const string Valve = "Valve"; public const string Valve = "valve"; /// <summary> /// 阻件 /// </summary> public const string Resistance = "Resistance"; public const string Resistance = "resistance"; /// <summary> /// 换热器 /// </summary> public const string Exchanger = "Exchanger"; public const string Exchanger = "exchanger"; /// <summary> /// 压缩机 /// </summary> public const string Compressor = "Compressor"; public const string Compressor = "compressor"; /// <summary> /// 操作 /// </summary> public const string Operation = "Operation"; public const string Operation = "operation"; /// <summary> /// 曲线 /// </summary> public const string Curve = "Curve"; public const string Curve = "curve"; /// <summary> /// 模式 /// </summary> public const string Pattern = "Pattern"; public const string Pattern = "pattern"; /// <summary> /// 规则 /// </summary> public const string Rule = "Rule"; public const string Rule = "rule"; Yw.Epanet.Calcu.Core/00-core/PumpStatus.cs
@@ -14,5 +14,8 @@ /// 关闭 /// </summary> public const string Closed = "CLOSED"; } } Yw.Epanet.Calcu.Core/00-core/ValveStatus.cs
@@ -19,5 +19,8 @@ /// 关闭 /// </summary> public const string Closed = "CLOSED"; } } Yw.Epanet.Calcu.Core/00-core/ValveType.cs
@@ -47,5 +47,8 @@ /// </summary> public const string PCV = "PCV"; } } Yw.Epanet.Calcu.Core/04-Inp/InpGenerater.cs
@@ -114,14 +114,14 @@ var endNodeId = x.EndNodeId; var propertySb = new StringBuilder(); //propertySb.Append($"Power {x.RatedP}");//此段代码注释,是因为每台水泵必须提供POWER或者HEAD,先暂时把功率去掉用于判断对计算的影响 propertySb.Append($" HEAD {x.CurveQH}"); propertySb.Append($" SPEED {x.SpeedRatio}"); propertySb.Append($" HEAD {x.CurveQH} "); propertySb.Append($" SPEED {x.SpeedRatio} "); if (!string.IsNullOrEmpty(x.SpeedRatioPattern)) { propertySb.Append($" PATTERN {x.SpeedRatioPattern}"); propertySb.Append($" PATTERN {x.SpeedRatioPattern} "); } var property = propertySb.ToString(); sb.AppendLine($"{id} \t{startNodeId} \t{endNodeId} \t{property} \t;"); sb.AppendLine($"{id} \t{startNodeId} \t{endNodeId} \t{property}\t;"); }); sb.AppendLine(string.Empty); @@ -228,8 +228,8 @@ sb.AppendLine(";ID \tStatus/Setting"); nw.Pipes?.ForEach(x => { var linkStatus = x.LinkStatus; if (linkStatus != PipeStatus.Closed) var linkStatus = x.LinkStatus?.ToUpper(); if (linkStatus != PipeStatus.Closed.ToUpper()) { linkStatus = null; } @@ -240,8 +240,8 @@ }); nw.Pumps?.ForEach(x => { var linkStatus = x.LinkStatus; if (linkStatus == PumpStatus.Open) var linkStatus = x.LinkStatus?.ToUpper(); if (linkStatus == PumpStatus.Open.ToUpper()) { if (x.SpeedRatio < 1) { @@ -255,8 +255,8 @@ }); nw.Valves?.ForEach(x => { var linkStatus = x.LinkStatus; if (x.LinkStatus == ValveStatus.Active) var linkStatus = x.LinkStatus?.ToUpper(); if (x.LinkStatus == ValveStatus.Active.ToUpper()) { linkStatus = x.ValveSetting; } Yw.Epanet.Calcu.Core/06-calcu/00-core/NetworkCalcuExtensions.cs
@@ -154,6 +154,16 @@ }); } if (File.Exists(inpFileName)) { File.Delete(inpFileName); } if (File.Exists(rptFileName)) { File.Delete(rptFileName); } return result; } Yw.Epanet.Calcu.Core/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -4,7 +4,7 @@ --> <Project> <PropertyGroup> <History>True|2025-04-25T12:14:40.2068921Z||;True|2025-04-25T09:40:30.3631996+08:00||;True|2025-03-28T11:08:28.0243167+08:00||;True|2025-03-28T10:53:40.3515997+08:00||;True|2025-03-12T19:06:53.4326230+08:00||;False|2025-03-12T19:04:42.3438938+08:00||;True|2025-03-12T16:14:19.2199322+08:00||;True|2025-03-12T14:01:23.6851127+08:00||;True|2025-03-12T10:58:01.1114649+08:00||;True|2025-03-12T10:39:45.7032714+08:00||;False|2025-03-10T14:34:27.3404982+08:00||;False|2025-03-10T14:34:23.4248606+08:00||;</History> <History>True|2025-05-07T06:24:10.8910593Z||;True|2025-05-07T12:55:54.5819079+08:00||;True|2025-05-07T10:38:14.3837764+08:00||;True|2025-04-25T20:14:40.2068921+08:00||;True|2025-04-25T09:40:30.3631996+08:00||;True|2025-03-28T11:08:28.0243167+08:00||;True|2025-03-28T10:53:40.3515997+08:00||;True|2025-03-12T19:06:53.4326230+08:00||;False|2025-03-12T19:04:42.3438938+08:00||;True|2025-03-12T16:14:19.2199322+08:00||;True|2025-03-12T14:01:23.6851127+08:00||;True|2025-03-12T10:58:01.1114649+08:00||;True|2025-03-12T10:39:45.7032714+08:00||;False|2025-03-10T14:34:27.3404982+08:00||;False|2025-03-10T14:34:23.4248606+08:00||;</History> <LastFailureDetails /> </PropertyGroup> </Project> Yw.Epanet.Calcu.Core/Yw.Epanet.Calcu.Core.csproj
@@ -5,7 +5,7 @@ <ImplicitUsings>enable</ImplicitUsings> <Nullable>disable</Nullable> <GeneratePackageOnBuild>True</GeneratePackageOnBuild> <Version>1.1.0</Version> <Version>1.1.3</Version> <PackageReleaseNotes>解决水力计算报错崩溃问题</PackageReleaseNotes> </PropertyGroup> Yw.Hydraulic.Test.Core/Program.cs
@@ -9,8 +9,6 @@ static void Main() { // 创建一个 Stopwatch 实例 Stopwatch stopwatch = new Stopwatch(); @@ -32,81 +30,85 @@ /// </summary> public static void CalcuH() { var a = " 627617 \tjunction473 \tjunction474 \tHEAD curve8\tSPEED 0.96\t;";//t1 var b = "627617 \tjunction473 \tjunction474 \tHEAD curve8\tSPEED 0.96\t;";//t2 var result = new CalcuResult(); using (var helper = new InteropXHelper()) { var code = helper.Open("test.inp", "test.rpt", string.Empty); if (code != eErrorCode.OK) { helper.GetError(code, out string errorMsg); result.FailedList.Add(new CalcuFailed() { Code = code, Message = errorMsg }); helper.Close(); return; } code = helper.SolveH(); var code = helper.Open("t1.inp", string.Empty, string.Empty); if (code != eErrorCode.OK) { if (code >= eErrorCode.Err101) { helper.GetError(code, out string errorMsg); result.FailedList.Add(new CalcuFailed() { Code = code, Message = errorMsg }); helper.Close(); return; result.Succeed = false; result.Message = "水力管网解析失败"; } } //节点计算值遍历获取 var allCalcuNodeDict = new Dictionary<string, CalcuNode>(); helper.GetCount(eCountType.Node, out int nodeCount); for (int i = 1; i <= nodeCount; i++) //水力运算 if (result.Succeed) { helper.GetNodeId(i, out string nodeId); helper.GetNodeValue(i, eNodeProperty.Head, out double headValue); helper.GetNodeValue(i, eNodeProperty.Pressure, out double pressureValue); helper.GetNodeValue(i, eNodeProperty.Demand, out double demandValue); var calcuNode = new CalcuNode() code = helper.SolveH(); if (code != eErrorCode.OK) { Id = nodeId, Head = headValue, Press = pressureValue, Demand = demandValue }; result.VisualList.Add(calcuNode); allCalcuNodeDict.Add(nodeId, calcuNode); if (code >= eErrorCode.Err101) { result.Succeed = false; result.Message = "水力运算失败"; } } } //管段计算值遍历获取 var allCalcuLinkDict = new Dictionary<string, CalcuLink>(); helper.GetCount(eCountType.Link, out int linkCount); for (int i = 1; i <= linkCount; i++) //计算结果 if (result.Succeed) { helper.GetLinkId(i, out string linkId); helper.GetLinkValue(i, eLinkProperty.Flow, out double flowValue); helper.GetLinkValue(i, eLinkProperty.Velocity, out double velocityValue); helper.GetLinkValue(i, eLinkProperty.HeadLoss, out double headLossValue); var calcuLink = new CalcuLink() //节点计算值遍历获取 var allCalcuNodeDict = new Dictionary<string, CalcuNode>(); helper.GetCount(eCountType.Node, out int nodeCount); for (int i = 1; i <= nodeCount; i++) { Id = linkId, Flow = flowValue, Velocity = velocityValue, HeadLoss = headLossValue, }; result.VisualList.Add(calcuLink); allCalcuLinkDict.Add(linkId, calcuLink); helper.GetNodeId(i, out string nodeId); helper.GetNodeValue(i, eNodeProperty.Head, out double headValue); helper.GetNodeValue(i, eNodeProperty.Pressure, out double pressureValue); helper.GetNodeValue(i, eNodeProperty.Demand, out double demandValue); var calcuNode = new CalcuNode() { Id = nodeId, Head = headValue, Press = pressureValue, Demand = demandValue }; result.VisualList.Add(calcuNode); allCalcuNodeDict.Add(nodeId, calcuNode); } //管段计算值遍历获取 var allCalcuLinkDict = new Dictionary<string, CalcuLink>(); helper.GetCount(eCountType.Link, out int linkCount); for (int i = 1; i <= linkCount; i++) { helper.GetLinkId(i, out string linkId); helper.GetLinkValue(i, eLinkProperty.Flow, out double flowValue); helper.GetLinkValue(i, eLinkProperty.Velocity, out double velocityValue); helper.GetLinkValue(i, eLinkProperty.HeadLoss, out double headLossValue); var calcuLink = new CalcuLink() { Id = linkId, Flow = flowValue, Velocity = velocityValue, HeadLoss = headLossValue, }; result.VisualList.Add(calcuLink); allCalcuLinkDict.Add(linkId, calcuLink); } } helper.Close(); } var item = result.VisualList.Find(x => x.Id == "627617"); }