duheng
2024-05-22 f0aaa59c3bb1ef75affcacadbcc8fae21149f52c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System; 
using System.Collections.Generic;
using System.Linq;
using System.Text; 
 
namespace IStation
{
    public class AnaGlobalParas
    { 
 
        public static CalcModel.AnaSetting Setting { get; set; }
 
        public static List<Model.RiverWaterLevelDrop> RiverWaterLevelDropList { get; set; }
 
        public static List<Model.ReservoirParas> ReservoirParasList { get; set; }
 
        public static double CalcReservoirLevel(double start_level, double flow)
        {
            var _list = ReservoirParasList;
       
            if (start_level <= _list.First().Level)
            {
                double area水库面积 = _list.First().Area;
 
                if (area水库面积 < 1)
                {
                    return start_level;
                }
 
 
 
                var height = flow / area水库面积 / 10000;
 
                return Math.Round(start_level + height, 4);
            }
            if (start_level >= _list.Last().Level)
            {
                double area水库面积 = _list.Last().Area;
 
                if (area水库面积 < 1)
                {
                    return start_level;
                }
                var height = flow / area水库面积 / 10000;
 
                return Math.Round(start_level + height, 4);
            }
 
            for (int i = 0; i < _list.Count; i++)
            {
                if (start_level < _list[i].Level)
                {
                    double area水库面积 = _list[i].Area;
                    var height = flow / area水库面积 / 10000;
 
                    return Math.Round(start_level + height, 4);
                }
            }
 
            {
                double area水库面积 = _list.Last().Area;
 
                if (area水库面积 < 1)
                {
                    return start_level;
                }
                var height = flow / area水库面积 / 10000;
 
                return Math.Round(start_level + height, 4);
            }
 
        }
 
    }
}