Shuxia Ning
2024-10-12 b94da76188b834922d2f13365b22208a4bc4049a
Hydro/Yw.EPAnet.Calcu.Core/04-Inp/InpInteropHelper.cs
@@ -73,7 +73,8 @@
                var pTemp = o.DemandPattern;
                if (string.IsNullOrEmpty(pTemp) || pTemp == ";" || pTemp == "_") pTemp = "";
                junctionStringBuilder.AppendLine($"{o.Id}\t{o.Elev}\t{o.Demand}\t{pTemp}\t;\t" + $"0\tNozzle\t{o.Coefficient}");
                emitterStringBuilder.AppendLine(o.Id + "    " + o.Coefficient);
                double Coe = o.Coefficient * Math.Pow(10 / 101.972, 0.5) / 1000 * 60;
                emitterStringBuilder.AppendLine(o.Id + "    " + Coe);
                coorStringBuilder.AppendLine(o.Id + "    " + o.Position.X + "    " + o.Position.Y);
            });
@@ -256,6 +257,7 @@
            var net = new Network();
            if (InpPath == null || !File.Exists(InpPath)) return null;
            List<InpCoor> points = new List<InpCoor>();
            StreamReader sr = new StreamReader(InpPath);
            //try
            {
@@ -428,6 +430,16 @@
                                    }
                                }
                                break;
                            case "EMITTERS":
                                {
                                    string id = parts[0];
                                    if (double.TryParse(parts[1], out double x))
                                    {
                                        double Coefficient = x / Math.Pow(10 / 101.972, 0.5) * 1000 / 60;
                                        net.Nozzles.Find(o => o.Id == id).Coefficient = Coefficient;
                                    }
                                }
                                break;
                        }
                    }
                }