ningshuxia
2024-04-25 769413fc5ff52240f001fb4bcfcca21728fb275a
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using IStation.Epanet.Enums;
 
namespace IStation.Epanet.Network.Structures
{
 
    ///<summary>Hydraulic tank structure.</summary>
    public class Tank : Node
    {
        public Tank(string name) : base(name) { }
 
        public override void ConvertUnits(Network nw)
        {
            // FIXME:Tanks and reservoirs here?
 
            FieldsMap fMap = nw.FieldsMap;
 
            // ... convert from user to internal units
            double ucfLength = fMap.GetUnits(FieldType.ELEV);
            Elevation /= ucfLength;
            H0 = Elevation + H0 / ucfLength;
            Hmin = Elevation + Hmin / ucfLength;
            Hmax = Elevation + Hmax / ucfLength;
            Area = Math.PI * Math.Pow(Area / ucfLength, 2) / 4.0;
            V0 /= fMap.GetUnits(FieldType.VOLUME);
            Vmin /= fMap.GetUnits(FieldType.VOLUME);
            Vmax /= fMap.GetUnits(FieldType.VOLUME);
            Kb /= Constants.SECperDAY;
            // tk.Volume = tk.V0;
            C = C0;
            V1Max *= Vmax;
        }
 
        public override NodeType NodeType => NodeType.Tank;
 
        ///<summary>Tank area (feet^2).</summary>
        public double Area { get; set; }
 
        ///<summary>Species concentration.</summary>
        public double C { get; set; }
 
        ///<summary>Initial water elev.</summary>
        public double H0 { get; set; }
 
        ///<summary>Maximum water elev (feet).</summary>
        public double Hmax { get; set; }
 
        ///<summary>Minimum water elev (feet).</summary>
        public double Hmin { get; set; }
 
        ///<summary>Reaction coeff. (1/days).</summary>
        public double Kb { get; set; }
 
        ///<summary>Type of mixing model</summary>
        public MixType MixModel { get; set; }
 
        ///<summary>Fixed grade time pattern.</summary>
        public Pattern Pattern { get; set; }
 
        ///<summary>Initial volume (feet^3).</summary>
        public double V0 { get; set; }
 
        ///<summary>Mixing compartment size</summary>
        public double V1Max { get; set; }
 
        ///<summary>Fixed grade time pattern</summary>
        public Curve Vcurve { get; set; }
 
        ///<summary>Maximum volume (feet^3).</summary>
        public double Vmax { get; set; }
 
        ///<summary>Minimum volume (feet^3).</summary>
        public double Vmin { get; set; }
 
#if NUCONVERT
 
        public double GetNuArea(UnitsType type) { return NUConvert.RevertArea(type, Area); }
 
        public double GetNuInitHead(UnitsType type) { return NUConvert.RevertDistance(type, H0); }
 
        public double GetNuInitVolume(UnitsType type) { return NUConvert.RevertVolume(type, V0); }
 
        public double GetNuMaximumHead(UnitsType type)
        {
            return NUConvert.RevertDistance(type, Hmax);
        }
 
        public double GetNuMaxVolume(UnitsType type) { return NUConvert.RevertVolume(type, Vmax); }
 
        public double GetNuMinimumHead(UnitsType type)
        {
            return NUConvert.RevertDistance(type, Hmin);
        }
 
        public double GetNuMinVolume(UnitsType type) { return NUConvert.RevertVolume(type, Vmin); }
 
        public void SetNuMinVolume(UnitsType type, double value)
        {
            Vmin = NUConvert.ConvertVolume(type, value);
        }
 
 
        public double GetNuMixCompartimentSize(UnitsType type)
        {
            return NUConvert.RevertVolume(type, V1Max);
        }
 
 
        public void SetNuArea(UnitsType type, double value)
        {
            Area = NUConvert.ConvertArea(type, value);
        }
 
        public void SetNuInitHead(UnitsType type, double value)
        {
            H0 = NUConvert.RevertDistance(type, value);
        }
 
        public void SetNuInitVolume(UnitsType type, double value)
        {
            V0 = NUConvert.ConvertVolume(type, value);
        }
 
 
        public void SetNuMaximumHead(UnitsType type, double value)
        {
            Hmax = NUConvert.RevertDistance(type, value);
        }
 
        public void SetNuMaxVolume(UnitsType type, double value)
        {
            Vmax = NUConvert.ConvertVolume(type, value);
        }
 
        public void SetNuMinimumHead(UnitsType type, double value)
        {
            Hmin = NUConvert.ConvertArea(type, value);
        }
 
        public void SetNuMixCompartimentSize(UnitsType type, double value)
        {
            V1Max = NUConvert.ConvertVolume(type, value);
        }
 
#endif
 
    }
 
}