lixiaojun
2025-01-22 46f64905a3c309a50c0f245b3350cdeb8dd699c6
Hydro/Yw.EPAnet.Calcu.Core/04-Inp/InpInteropHelper.cs
@@ -155,8 +155,22 @@
            valveSb.AppendLine(";ID                 Node1              Node2              Diameter       Type   Setting        MinorLoss  ");
            network.Valves?.ForEach(x =>
            {
                valveSb.AppendLine($"{x.Id}\t{x.StartNode.Id}\t{x.EndNode.Id}\t{x.Diameter:F4}\t{x.ValveType}\t{x.ValveSetting}\t{x.MinorLoss:F4}\t;\t");// + $"0");
                if (!string.IsNullOrEmpty(x.LinkStatus))
                if (x.Id == "694311")
                {
                }
                string settings;
                if (x.LinkStatus == ValveStatus.None)
                {
                    settings = x.ValveSetting;
                }
                else
                {
                    settings = "Undefined";
                }
                if (string.IsNullOrEmpty(settings)) settings = "Undefined";
                valveSb.AppendLine($"{x.Id}\t{x.StartNode.Id}\t{x.EndNode.Id}\t{x.Diameter:F4}\t{x.ValveType}\t{settings}\t{x.MinorLoss:F4}\t;\t");// + $"0");
                if (!string.IsNullOrEmpty(x.LinkStatus) && x.LinkStatus != ValveStatus.None)
                {
                    statusSb.AppendLine(x.Id + "\t" + x.LinkStatus);
                }
@@ -172,8 +186,19 @@
                {
                    type = "Compressor";
                }
                valveSb.AppendLine($"{x.Id}\t{x.StartNode.Id}\t{x.EndNode.Id}\t{x.Diameter:F4}\tGPV\t{x.CurveQL}\t{x.MinorLoss:F4}\t;\t{type}");// + $"0");
                if (!string.IsNullOrEmpty(x.LinkStatus))
                string settings;
                if (x.LinkStatus == ValveStatus.None)
                {
                    settings = x.CurveQL;
                }
                else
                {
                    settings = "Undefined";
                }
                if (string.IsNullOrEmpty(settings)) settings = "Undefined";
                valveSb.AppendLine($"{x.Id}\t{x.StartNode.Id}\t{x.EndNode.Id}\t{x.Diameter:F4}\tGPV\t{settings}\t{x.MinorLoss:F4}\t;\t{type}");// + $"0");
                if (!string.IsNullOrEmpty(x.LinkStatus) && x.LinkStatus != ValveStatus.None)
                {
                    statusSb.AppendLine(x.Id + "\t" + x.LinkStatus);
                }
@@ -198,7 +223,11 @@
                    else
                        statusString = $"\t{o.SpeedRatio}";
                }
                statusSb.AppendLine(o.Id + statusString);
                if (!string.IsNullOrEmpty(o.LinkStatus))
                {
                    statusSb.AppendLine(o.Id + statusString);
                }
            });
            string pumpString = pumpSb.ToString();
@@ -447,8 +476,8 @@
                                    float minorLoss;
                                    if (float.TryParse(parts[6], out minorLoss))
                                        p.MinorLossCoeff = minorLoss;
                                    p.LinkStatus = parts.Length > 7 ? (parts[7].ToUpper().Contains("CLOSE")? PipeStatus.Closed : PipeStatus.Open) : PipeStatus.Open;
                                    p.LinkStatus = parts.Length > 7 ? (parts[7].ToUpper().Contains("CLOSE") ? PipeStatus.Closed : PipeStatus.Open) : PipeStatus.Open;
                                    net.Pipes.Add(p);
                                }
                                break;
@@ -518,7 +547,7 @@
                            case "PUMPS":
                                {
                                    InpPump pump = new InpPump();
                                    pump.Id = parts.ToString(0, null);
                                    // 取出Node1和Node2中的字母部分,例如“S201326593”被取出为“201326593”
@@ -610,7 +639,7 @@
                    J.Position = new Position2d();
                    J.Position.X = coor.Position.X;
                    J.Position.Y = coor.Position.Y;
                    k1++;
                }
                #endregion