/// <summary> /// Initializes a new instance of the <see cref="DegreeOfSaturation"/> class. /// </summary> /// <param name="waterVolume">V_w in S=V_w/V_v.</param> /// <param name="voidVolume">V_v in S=V_w/V_v.</param> public DegreeOfSaturation(WaterVolume waterVolume, VolumeOfVoids voidVolume) { this.Symbol = "S"; var converted = BaseVolumeScalar.ConvertToUnits(waterVolume, voidVolume.UnitOfMeasure); this.NumericValue = converted.NumericValue / voidVolume.NumericValue; }
/// <summary> /// Initializes a new instance of the <see cref="VoidRatio"/> class. /// </summary> /// <param name="voidVolume">V_v in e=V_v/V_s.</param> /// <param name="solidVolume">V_s in e=V_v/V_s.</param> public VoidRatio(VolumeOfVoids voidVolume, VolumeOfSolidMatter solidVolume) { this.Symbol = "e"; var converted = BaseVolumeScalar.ConvertToUnits(voidVolume, solidVolume.UnitOfMeasure); this.NumericValue = converted.NumericValue / solidVolume.NumericValue; }
/// <summary> /// Initializes a new instance of the <see cref="Porosity"/> class. /// </summary> /// <param name="voidVolume">V_v in n=V_v/V.</param> /// <param name="totalVolume">V in n=V_v/V.</param> public Porosity(VolumeOfVoids voidVolume, TotalVolume totalVolume) { this.Symbol = "n"; var converted = BaseVolumeScalar.ConvertToUnits(voidVolume, totalVolume.UnitOfMeasure); this.NumericValue = converted.NumericValue / totalVolume.NumericValue; }
/// <summary> /// Unit Weight conversion function from Metric to Metric, Metric to English, or vice versa. /// </summary> /// <param name="toConvert">Original, operating, unit weight.</param> /// <param name="toConvertTo">Measurement unit to convert into (ie cc).</param> /// <returns>A new unit weight with correct type and numeric value.</returns> public static BaseVolumeScalar ConvertToUnits(BaseVolumeScalar toConvert, VolumeUnits toConvertTo) { if (toConvert.UnitOfMeasure == toConvertTo) { return(toConvert); } double newVal = toConvert.NumericValue; if (toConvert.UnitOfMeasure == VolumeUnits.CubicCentimeters && toConvertTo == VolumeUnits.CubicMeters) { newVal /= 1e6; } else if (toConvert.UnitOfMeasure == VolumeUnits.CubicCentimeters && toConvertTo == VolumeUnits.CubicFeet) { newVal /= 28316.8199; } else if (toConvert.UnitOfMeasure == VolumeUnits.CubicFeet && toConvertTo == VolumeUnits.CubicCentimeters) { newVal *= 28316.8199; } else if (toConvert.UnitOfMeasure == VolumeUnits.CubicFeet && toConvertTo == VolumeUnits.CubicMeters) { newVal /= 35.3147; } else if (toConvert.UnitOfMeasure == VolumeUnits.CubicMeters && toConvertTo == VolumeUnits.CubicCentimeters) { newVal *= 1e6; } else if (toConvert.UnitOfMeasure == VolumeUnits.CubicMeters && toConvertTo == VolumeUnits.CubicFeet) { newVal *= 35.3147; } BaseVolumeScalar toReturn = new BaseVolumeScalar(toConvert.Symbol, newVal, toConvertTo); return(toReturn); }