ningshuxia
2024-03-20 785c92f5078cb7aeb05b13f6da627defb6525b36
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
using IStation.Epanet.Enums;
using System;
 
namespace IStation.Epanet.Network.Structures
{
 
    public class Junction : Node
    {
        public Junction(string name) : base(name) { }
 
        public override void ConvertUnits(Network nw)
        {
            FieldsMap fMap = nw.FieldsMap;
 
            // ... convert elevation & initial quality units
            Elevation /= fMap.GetUnits(FieldType.ELEV);
            C0 /= fMap.GetUnits(FieldType.QUALITY);
 
            // ... if no demand categories exist, add primary demand to list
            if (Demands.Count == 0) { Demands.Add(PrimaryDemand); }
 
            // ... convert flow units for base demand in each demand category
            double qcf = fMap.GetUnits(FieldType.DEMAND);
 
            foreach (Demand d in Demands)
            {
                d.Base /= qcf;
            }
 
            // ... convert emitter flow units
            if (Ke > 0.0)
            {
                double ucf = Math.Pow(fMap.GetUnits(FieldType.FLOW), nw.QExp) / fMap.GetUnits(FieldType.PRESSURE);
 
                Ke = ucf / Math.Pow(Ke, nw.QExp);
            }
 
        }
 
    }
}