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]; }
|
}
|
|
}
|