ningshuxia
2024-06-18 e83dca6e861b622b54d3392ca0d3f1f1eb69f7c9
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
149
150
151
152
153
154
155
using IStation.Epanet.Enums;
 
namespace IStation.Epanet.Network.Structures
{
 
    ///<summary>Hydraulic pump structure.</summary>
    public class Pump : Link
    {
        public Pump(string name) : base(name)
        {
            // Link attributes
            Kc = 1.0;
            Status = StatusType.OPEN;
 
            // Pump attributes
            Ptype = PumpType.NOCURVE;
        }
 
        public override LinkType LinkType => LinkType.Pump;
 
        public override void InitResistance(HeadLossFormulaType formflag, double hexp)
        {
            FlowResistance = Constants.CBIG;
        }
 
        public override void ConvertUnits(Network nw)
        {
            FieldsMap fMap = nw.FieldsMap;
 
            if (Ptype == PumpType.CONST_HP)
            {
                if (nw.UnitsFlag == UnitsType.SI)
                    FlowCoefficient /= fMap.GetUnits(FieldType.POWER);
            }
            else
            {
                if (Ptype == PumpType.POWER_FUNC)
                {
                    H0 /= fMap.GetUnits(FieldType.HEAD);
 
                    FlowCoefficient *=
                                           Math.Pow(fMap.GetUnits(FieldType.FLOW), N) /
                                           fMap.GetUnits(FieldType.HEAD);
                }
 
                Q0 /= fMap.GetUnits(FieldType.FLOW);
                Qmax /= fMap.GetUnits(FieldType.FLOW);
                Hmax /= fMap.GetUnits(FieldType.HEAD);
            }
 
        }
 
 
        ///<summary>Unit energy cost.</summary>
        public double ECost { get; set; }
 
        ///<summary>Effic. v. flow curve reference.</summary>
        public Curve ECurve { get; set; }
 
        ///<summary>Energy usage statistics.</summary>
        public double[] Energy { get; } = { 0, 0, 0, 0, 0, 0 };
 
        ///<summary>Energy cost pattern.</summary>
        public Pattern EPat { get; set; }
 
        ///<summary>Flow coefficient.</summary>
        public double FlowCoefficient { get; set; }
 
        ///<summary>Shutoff head (feet)</summary>
        public double H0 { get; set; }
 
        ///<summary>Head v. flow curve reference.</summary>
        public Curve HCurve { get; set; }
 
        ///<summary>Maximum head (feet)</summary>
        public double Hmax { get; set; }
 
        ///<summary>Flow exponent.</summary>
        public double N { get; set; }
 
        ///<summary>Pump curve type.</summary>
        public PumpType Ptype { get; set; }
 
        ///<summary>Initial flow (feet^3/s).</summary>
        public double Q0 { get; set; }
 
        ///<summary>Maximum flow (feet^3/s).</summary>
        public double Qmax { get; set; }
 
        ///<summary>Utilization pattern reference.</summary>
        public Pattern UPat { get; set; }
 
#if NUCONVERT
 
        public double GetNuFlowCoefficient(UnitsType utype)
        {
            return NUConvert.RevertPower(utype, FlowCoefficient);
        }
 
 
        public double GetNuInitialFlow(FlowUnitsType utype)
        {
            return NUConvert.RevertFlow(utype, Q0);
        }
 
        public double GetNuMaxFlow(FlowUnitsType utype)
        {
            return NUConvert.RevertFlow(utype, Qmax);
        }
 
        public double GetNuMaxHead(UnitsType utype)
        {
            return NUConvert.RevertDistance(utype, Hmax);
        }
 
        public double GetNuShutoffHead(UnitsType utype)
        {
            return NUConvert.RevertDistance(utype, Hmax);
        }
 
 
        public void SetNuFlowCoefficient(UnitsType utype, double value)
        {
            FlowCoefficient = NUConvert.ConvertPower(utype, value);
        }
 
        public void SetNuInitialFlow(FlowUnitsType utype, double value)
        {
            Q0 = NUConvert.ConvertFlow(utype, value);
        }
 
        public void SetNuMaxFlow(FlowUnitsType utype, double value)
        {
            Qmax = NUConvert.ConvertFlow(utype, value);
        }
 
        public void SetNuMaxHead(UnitsType utype, double value)
        {
            Hmax = NUConvert.ConvertDistance(utype, value);
        }
 
        public void SetNuShutoffHead(UnitsType utype, double value)
        {
            H0 = NUConvert.ConvertDistance(utype, value);
        }
 
 
#endif
 
 
 
 
    }
 
}