using IStation.Epanet.Enums;
namespace IStation.Epanet.Network.Structures
{
///Hydraulic tank structure.
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;
///Tank area (feet^2).
public double Area { get; set; }
///Species concentration.
public double C { get; set; }
///Initial water elev.
public double H0 { get; set; }
///Maximum water elev (feet).
public double Hmax { get; set; }
///Minimum water elev (feet).
public double Hmin { get; set; }
///Reaction coeff. (1/days).
public double Kb { get; set; }
///Type of mixing model
public MixType MixModel { get; set; }
///Fixed grade time pattern.
public Pattern Pattern { get; set; }
///Initial volume (feet^3).
public double V0 { get; set; }
///Mixing compartment size
public double V1Max { get; set; }
///Fixed grade time pattern
public Curve Vcurve { get; set; }
///Maximum volume (feet^3).
public double Vmax { get; set; }
///Minimum volume (feet^3).
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
}
}