ningshuxia
2025-03-17 c4b3f80d78846cb67ab21b09cc2b3224aca37311
系统曲线修改
已删除4个文件
已重命名5个文件
已修改2个文件
925 ■■■■ 文件已修改
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/SystemCurvePage.Designer.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/SystemCurvePage.cs 119 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/SystemCurvePage.resx 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/WaterDistributionCalculator - 复制.cs 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/WaterDistributionCalculator.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurveCalcHelper - 复制.cs 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurvePage - 复制.Designer.cs 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurvePage - 复制.cs 297 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurvePage - 复制.resx 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/PBS.WinFrmUI.Hydro.csproj 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/PBS.WinFrmUI.Hydro.csproj.user 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/SystemCurvePage.Designer.cs
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/SystemCurvePage.cs
ÎļþÃû´Ó WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurvePage.cs ÐÞ¸Ä
@@ -60,7 +60,8 @@
        public class CalcNodeViewModel
        {
            public int NodeIndex { get; set; }
            public int NodeIndex { get; set; }
            public double Elevation { get; set; }
            public double Flow { get; set; }
            public double Pressure { get; set; }
        }
@@ -122,6 +123,11 @@
            _constantLineDynamicPressure.ShowInLegend = false;
            _constantLineStaticPressure.ShowInLegend = false;
            _constantLineDynamicPressure.Title.Alignment = ConstantLineTitleAlignment.Far;
            _constantLineStaticPressure.Title.Alignment = ConstantLineTitleAlignment.Far;
            _constantLineDynamicPressure.LineStyle.Thickness = 2;
            _constantLineStaticPressure.LineStyle.Thickness = 2;
            _xyDiagram.EnableAxisXZooming = true;
            _xyDiagram.EnableAxisYZooming = true;
@@ -137,10 +143,11 @@
            var minDemand = 0;   // æœ€å°æ€»éœ€æ°´é‡(m³/h)
            var maxDemand = 43;  // æœ€å¤§æ€»éœ€æ°´é‡(m³/h)
            var reservoirElevation = -4; //水池标高
            var calcCount = 5000;           // è®¡ç®—次数
            var staticPressure = 22; //静压
            var calcCount = 1000;           // è®¡ç®—次数
            var staticPressure = 22.5; //静压
            var requiredEndPressure = 18; //静压
            CalcSystemCurve(file_path, minDemand, maxDemand, reservoirElevation, staticPressure, calcCount);
            CalcSystemCurve(file_path, minDemand, maxDemand, reservoirElevation, staticPressure, requiredEndPressure, calcCount);
        }
        private void CalcSystemCurve(
@@ -149,15 +156,13 @@
            double maxDemand,
            double reservoirElevation,
            double staticPressure,
            double requiredEndPressure,
            int calcCount)
        {
            var pressure = 0d;
            var nodeConfig = new List<WaterDistributionCalculator.NodeConfig>();
            var userNodeList = new List<int>();
            var calcResultList = new List<CalcResultViewModel>(calcCount);
            using (var helper = new Yw.Epanet.InteropXHelper())
            {
                var code = helper.Open(inpFilePath, "", "");
@@ -169,10 +174,11 @@
                    helper.GetNodeType(nodeIndex, out Yw.Epanet.eNodeType nodeType);
                    if (nodeType == Yw.Epanet.eNodeType.Junction)
                    {
                        userNodeList.Add(nodeIndex);
                        helper.GetNodeValue(nodeIndex, Yw.Epanet.eNodeProperty.Elevation, out double elevation);
                        nodeConfig.Add(new WaterDistributionCalculator.NodeConfig()
                        {
                            NodeIndex = nodeIndex,
                            Elevation = elevation,
                            MinFlow = 0,
                            MaxFlow = rand.NextDouble() * 5
                        });
@@ -184,9 +190,10 @@
                    }
                }
                var userNodeCount = userNodeList.Count;
                var userNodeCount = nodeConfig.Count;
                var calculator = new WaterDistributionCalculator(nodeConfig, calcCount, minDemand, maxDemand);
                var allDemands = calculator.CalculateDistributions();
                code = helper.OpenH();
                for (int count = 0; count < allDemands.Count; count++)
                {
@@ -195,8 +202,9 @@
                    helper.InitH(false);
                    var demands = allDemands[count];
                    foreach (var userNodeIndex in userNodeList)
                    foreach (var node in nodeConfig)
                    {
                        var userNodeIndex = node.NodeIndex;
                        double demand = demands.NodeFlows[userNodeIndex];
                        code = helper.SetNodeValue(userNodeIndex, Yw.Epanet.eNodeProperty.BaseDemand, demand);
                        CheckCode(code);
@@ -211,17 +219,23 @@
                    helper.RunH(out long t);
                    foreach (var userNodeIndex in userNodeList)
                    foreach (var node in nodeConfig)
                    {
                        var userNodeIndex = node.NodeIndex;
                        pressure = 0;
                        //code = helper.GetNodeValue(userNodeIndex, Yw.Epanet.eNodeProperty.Pressure, out pressure);
                        code = helper.GetNodeValue(userNodeIndex, Yw.Epanet.eNodeProperty.Head, out pressure);
                        CheckCode(code);
                        calcNodelDict[userNodeIndex].Pressure = pressure;
                        if (calcEndPressure > pressure)
                        //code = helper.GetNodeValue(userNodeIndex, Yw.Epanet.eNodeProperty.Pressure, out pressure);
                        //CheckCode(code);
                        //var endPressure = pressure + node.Elevation;
                        code = helper.GetNodeValue(userNodeIndex, Yw.Epanet.eNodeProperty.Pressure, out pressure);
                        CheckCode(code);
                        var endPressure = pressure + node.Elevation;
                        calcNodelDict[userNodeIndex].Pressure = endPressure;
                        if (calcEndPressure > endPressure)
                        {
                            calcEndPressure = pressure;
                            calcEndPressure = endPressure;
                        }
                    }
@@ -243,7 +257,6 @@
            this.chartControl1.BeginInit();
@@ -253,17 +266,18 @@
            _waterPointList = null;
            // _seriesWaterPoint.BindToData(null, "", "");
            // _seriesUpperPressure.Points.Clear();
            //_seriesLowerPressure.Points.Clear();
            // _seriesAveragePressure.Points.Clear();
            _seriesWaterPoint.Points.Clear();
            _seriesUpperPressure.Points.Clear();
            _seriesLowerPressure.Points.Clear();
            _seriesAveragePressure.Points.Clear();
            _constantLineDynamicPressure.Visible = false;
            _constantLineStaticPressure.Visible = false;
            if (calcResultList.Any())
            {
                _waterPointList = calcResultList.Select(x => new PointViewModel(x.TotalFlow, x.EndPressure + staticPressure)).ToList();
                _waterPointList = calcResultList.Select(x => new PointViewModel(x.TotalFlow, x.EndPressure + staticPressure + requiredEndPressure)).ToList();
                //_waterPointList = calcResultList.Select(x => new PointViewModel(x.TotalFlow, x.EndPressure + staticPressure)).ToList();
                var waterPointGroup = _waterPointList.GroupBy(x => Math.Round(x.X, 1));
                var upperPressurePtList = new List<Yw.Geometry.Point2d>();
@@ -293,17 +307,66 @@
                var lowerPressureCurvePtList = _curveLowerPressure.GetPointList(100);
                var averagePressureCurvePtList = _curveAveragePressure.GetPointList(100);
                _seriesWaterPoint.BindToData(_waterPointList, "X", "Y");
                _seriesUpperPressure.BindToData(upperPressureCurvePtList, "X", "Y");
                _seriesLowerPressure.BindToData(lowerPressureCurvePtList, "X", "Y");
                _seriesAveragePressure.BindToData(averagePressureCurvePtList, "X", "Y");
                foreach (var item in _waterPointList)
                {
                    _seriesWaterPoint.Points.Add(new SeriesPoint(item.X, item.Y));
                }
                foreach (var item in upperPressureCurvePtList)
                {
                    _seriesUpperPressure.Points.Add(new SeriesPoint(item.X, item.Y));
                }
                foreach (var item in lowerPressureCurvePtList)
                {
                    _seriesLowerPressure.Points.Add(new SeriesPoint(item.X, item.Y));
                }
                foreach (var item in averagePressureCurvePtList)
                {
                    _seriesAveragePressure.Points.Add(new SeriesPoint(item.X, item.Y));
                }
                var minX = _waterPointList.Min(x => x.X);
                var maxX = _waterPointList.Max(x => x.X);
                var minY = _waterPointList.Min(x => x.Y);
                var maxY = _waterPointList.Max(x => x.Y);
                var minDynamicPressure = minY;
                _constantLineDynamicPressure.AxisValue = minDynamicPressure;
                _constantLineDynamicPressure.Title.Text = $"最低供水压力:{minDynamicPressure:N2}m";
                _constantLineDynamicPressure.Visible = true;
                var totalStaticPressure = staticPressure + Math.Abs(reservoirElevation);
                _constantLineStaticPressure.AxisValue = totalStaticPressure;
                _constantLineStaticPressure.Title.Text = $"静压:{totalStaticPressure:N2}";
                _constantLineStaticPressure.Title.Text = $"最高楼层高度:{totalStaticPressure:N2}m";
                _constantLineStaticPressure.Visible = true;
                minY = Math.Min(staticPressure, minY);
                maxY = Math.Max(staticPressure, maxY);
                minY = Math.Min(staticPressure, minY);
                maxY = Math.Max(staticPressure, maxY);
                maxY = Math.Floor(maxY);
                maxX = Math.Floor(maxX);
                _xyDiagram.AxisX.WholeRange.Auto = true;
                _xyDiagram.AxisX.VisualRange.Auto = true;
                _xyDiagram.AxisX.WholeRange.SideMarginsValue = 0;
                _xyDiagram.AxisX.VisualRange.SideMarginsValue = 0;
                _xyDiagram.AxisX.NumericScaleOptions.AutoGrid = true;
                _xyDiagram.AxisX.WholeRange.SetMinMaxValues(minX, 50);
                _xyDiagram.AxisX.VisualRange.SetMinMaxValues(minX, 50);
                _xyDiagram.AxisY.WholeRange.Auto = true;
                _xyDiagram.AxisY.VisualRange.Auto = true;
                _xyDiagram.AxisY.NumericScaleOptions.AutoGrid = true;
                _xyDiagram.AxisY.WholeRange.SideMarginsValue = 0;
                _xyDiagram.AxisY.VisualRange.SideMarginsValue = 0;
                _xyDiagram.AxisY.WholeRange.SetMinMaxValues(minY, 70);
                _xyDiagram.AxisY.VisualRange.SetMinMaxValues(minY, 70);
            }
            this.chartControl1.EndInit();
        }
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/SystemCurvePage.resx
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/WaterDistributionCalculator - ¸´ÖÆ.cs
WinFrmUI/PBS.WinFrmUI.Hydro/01-system-curve/WaterDistributionCalculator.cs
ÎļþÃû´Ó WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/WaterDistributionCalculator.cs ÐÞ¸Ä
@@ -4,6 +4,7 @@
    public class NodeConfig
    {
        public int NodeIndex { get; set; }
        public double Elevation { get; set; }
        public double MinFlow { get; set; }  // æœ€å°éœ€æ°´é‡(m³/h)
        public double MaxFlow { get; set; }  // æœ€å¤§éœ€æ°´é‡(m³/h)
    }
@@ -64,7 +65,7 @@
    private IEnumerable<DistributionResult> GenerateAllocations(double targetDemand)
    {
        var rand = new Random();
        int maxAttempts = 3; //最大尝试次数
        int maxAttempts = 2; //最大尝试次数
        // åŸºäºŽèŠ‚ç‚¹ä¼˜å…ˆçº§ç”Ÿæˆå€™é€‰é›†ï¼ˆå‚è€ƒBP神经网络特征选择[3](@ref))
        var candidateNodes = _nodes
@@ -88,7 +89,7 @@
            // éšæœºåˆ†é…å‰©ä½™æ°´é‡ï¼ˆé‡‡ç”¨è‡ªé€‚应权重调整[6](@ref))
            // while (remaining > 0.001) // å…è®¸1L误差
            while (remaining > 0.1)
            while (remaining > 0.5)
            {
                var availableNodes = candidateNodes
                    .Where(n => allocation[n.NodeIndex] < n.MaxFlow)
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurveCalcHelper - ¸´ÖÆ.cs
ÎļþÒÑɾ³ý
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurvePage - ¸´ÖÆ.Designer.cs
ÎļþÒÑɾ³ý
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurvePage - ¸´ÖÆ.cs
ÎļþÒÑɾ³ý
WinFrmUI/PBS.WinFrmUI.Hydro/01-water-supply-system-curve/SystemCurvePage - ¸´ÖÆ.resx
ÎļþÒÑɾ³ý
WinFrmUI/PBS.WinFrmUI.Hydro/PBS.WinFrmUI.Hydro.csproj
@@ -19,14 +19,14 @@
  </ItemGroup>
  <ItemGroup>
    <Compile Remove="01-water-supply-system-curve\SystemCurveCalcHelper - å¤åˆ¶.cs" />
    <Compile Remove="01-water-supply-system-curve\SystemCurvePage - å¤åˆ¶.cs" />
    <Compile Remove="01-water-supply-system-curve\SystemCurvePage - å¤åˆ¶.Designer.cs" />
    <Compile Remove="01-water-supply-system-curve\WaterDistributionCalculator - å¤åˆ¶.cs" />
    <Compile Remove="01-system-curve\SystemCurveCalcHelper - å¤åˆ¶.cs" />
    <Compile Remove="01-system-curve\SystemCurvePage - å¤åˆ¶.cs" />
    <Compile Remove="01-system-curve\SystemCurvePage - å¤åˆ¶.Designer.cs" />
    <Compile Remove="01-system-curve\WaterDistributionCalculator - å¤åˆ¶.cs" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Remove="01-water-supply-system-curve\SystemCurvePage - å¤åˆ¶.resx" />
    <EmbeddedResource Remove="01-system-curve\SystemCurvePage - å¤åˆ¶.resx" />
  </ItemGroup>
  <ItemGroup>
WinFrmUI/PBS.WinFrmUI.Hydro/PBS.WinFrmUI.Hydro.csproj.user
@@ -2,7 +2,7 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup />
  <ItemGroup>
    <Compile Update="01-water-supply-system-curve\SystemCurvePage.cs">
    <Compile Update="01-system-curve\SystemCurvePage.cs">
      <SubType>UserControl</SubType>
    </Compile>
  </ItemGroup>