duheng
2025-03-18 7ee0220b5f5626deef516b6e5c417bfa201e5a88
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;
 
namespace IStation.Epanet.Network.Structures
{
 
    ///<summary>Report field properties.</summary>
    public class Field
    {
        ///<summary>Lower/upper report limits.</summary>
        private readonly double[] _rptLim = { 0d, 0d, 0d };
 
        ///<summary>Init field name, precision, report limit and state.</summary>
        /// <param name="name">Field name.</param>
        public Field(FieldType type)
        {
            Type = type;
            Enabled = false;
            Precision = 2;
            SetRptLim(RangeType.LOW, Constants.BIG * Constants.BIG);
            SetRptLim(RangeType.HI, -Constants.BIG * Constants.BIG);
        }
 
 
        public FieldType Type { get; }
        ///<summary>Name of reported variable.</summary>
        public string Name => Type.ParseStr();
 
        ///<summary>Number of decimal places.</summary>
        public int Precision { get; set; }
 
        ///<summary>Units of reported variable.</summary>
        public string Units { get; set; }
 
        ///<summary>Enabled if in table.</summary>
        public bool Enabled { get; set; }
 
        public void SetRptLim(RangeType type, double value) { _rptLim[(int)type] = value; }
        public double GetRptLim(RangeType type) { return _rptLim[(int)type]; }
    }
 
}