public void ConvertFromFt3ToCC() { BaseVolumeScalar bvs = new BaseVolumeScalar("x", 10, VolumeUnits.CubicFeet); BaseVolumeScalar converted = BaseVolumeScalar.ConvertToUnits(bvs, VolumeUnits.CubicCentimeters); Assert.AreEqual("x", converted.Symbol); Assert.AreEqual(Math.Round(converted.NumericValue, 2), 283168.2); Assert.AreEqual(converted.UnitOfMeasure, VolumeUnits.CubicCentimeters); }
public void ConvertFromM3ToFt3() { BaseVolumeScalar bvs = new BaseVolumeScalar("x", 10, VolumeUnits.CubicMeters); BaseVolumeScalar converted = BaseVolumeScalar.ConvertToUnits(bvs, VolumeUnits.CubicFeet); Assert.AreEqual("x", converted.Symbol); Assert.AreEqual(Math.Round(converted.NumericValue, 3), 353.147); Assert.AreEqual(converted.UnitOfMeasure, VolumeUnits.CubicFeet); }
public void ConvertFromM3ToM3() { BaseVolumeScalar bvs = new BaseVolumeScalar("x", 10, VolumeUnits.CubicMeters); BaseVolumeScalar converted = BaseVolumeScalar.ConvertToUnits(bvs, VolumeUnits.CubicMeters); Assert.AreEqual("x", converted.Symbol); Assert.AreEqual(converted.NumericValue, 10); Assert.AreEqual(converted.UnitOfMeasure, VolumeUnits.CubicMeters); }
public void ConvertFromCCToM3() { BaseVolumeScalar bvs = new BaseVolumeScalar("x", 10, VolumeUnits.CubicCentimeters); BaseVolumeScalar converted = BaseVolumeScalar.ConvertToUnits(bvs, VolumeUnits.CubicMeters); Assert.AreEqual("x", converted.Symbol); Assert.AreEqual(Math.Round(converted.NumericValue, 6), 1e-5); Assert.AreEqual(converted.UnitOfMeasure, VolumeUnits.CubicMeters); }
/// <summary> /// Initializes a new instance of the <see cref="UnitWeightOfSolids"/> class. /// </summary> /// <param name="solidWeight">W_s in gamma_s=W_s/V_s.</param> /// <param name="solidVolume">V_s in gamma_s=W_s/V_s.</param> /// <param name="units">Measurement system to hold value in after initial calculation.</param> public UnitWeightOfSolids(WeightOfSolidMatter solidWeight, VolumeOfSolidMatter solidVolume, UnitWeightUnits units) : this(ConvertToUnits(new BaseUnitWeightScalar("𝛾", BaseWeightScalar.ConvertToUnits(solidWeight, WeightUnits.Kilograms).NumericValue / BaseVolumeScalar.ConvertToUnits(solidVolume, VolumeUnits.CubicMeters).NumericValue, UnitWeightUnits.KilogramPerMeterCubed), units).NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="TotalVolume"/> class. /// </summary> /// <param name="porosity">n in n=V_v/V.</param> /// <param name="voidVolume">V_v in n=V_v/V.</param> /// <param name="units">Measurement system to hold value after initial calculation (ie cc).</param> public TotalVolume(Porosity porosity, VolumeOfVoids voidVolume, VolumeUnits units) : this(BaseVolumeScalar.ConvertToUnits(voidVolume, units).NumericValue / porosity.NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="TotalWeight"/> class. /// </summary> /// <param name="massSpecificGravity">G_m in W=G_m*gamma_w*V.</param> /// <param name="unitWeightOfWater">gamma_w in W=G_m*gamma_w*V.</param> /// <param name="totalVolume">V in W=G_m*gamma_w*V.</param> /// <param name="units">Measurement unit to hold value after initial calculation (ie kg).</param> public TotalWeight(MassSpecificGravity massSpecificGravity, UnitWeightOfWater unitWeightOfWater, TotalVolume totalVolume, WeightUnits units) : this(ConvertToUnits(new BaseWeightScalar("𝛾", BaseUnitWeightScalar.ConvertToUnits(unitWeightOfWater, UnitWeightUnits.KilogramPerMeterCubed).NumericValue *BaseVolumeScalar.ConvertToUnits(totalVolume, VolumeUnits.CubicMeters).NumericValue *massSpecificGravity.NumericValue, WeightUnits.Kilograms), units).NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="VolumeOfVoids"/> class. /// </summary> /// <param name="degreeOfSaturation">S in S=V_w/V_v.</param> /// <param name="waterVolume">V_w in S=V_w/V_v.</param> /// <param name="units">Measurement units to hold value after initial calculation (ie cc).</param> public VolumeOfVoids(DegreeOfSaturation degreeOfSaturation, WaterVolume waterVolume, VolumeUnits units) : this(BaseVolumeScalar.ConvertToUnits(waterVolume, units).NumericValue / degreeOfSaturation.NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="VolumeOfVoids"/> class. /// </summary> /// <param name="voidRatio">e in e=V_v/V_s.</param> /// <param name="solidVolume">V_s in e=V_v/V_s.</param> /// <param name="units">Measurement units to hold value after initial calculation (ie cc).</param> public VolumeOfVoids(VoidRatio voidRatio, VolumeOfSolidMatter solidVolume, VolumeUnits units) : this(BaseVolumeScalar.ConvertToUnits(solidVolume, units).NumericValue *voidRatio.NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="VolumeOfVoids"/> class. /// </summary> /// <param name="porosity">n in n=V_v/V.</param> /// <param name="totalVolume">V in n=V_v/V.</param> /// <param name="units">Measurement units to hold value after initial calculation (ie cc).</param> public VolumeOfVoids(Porosity porosity, TotalVolume totalVolume, VolumeUnits units) : this(BaseVolumeScalar.ConvertToUnits(totalVolume, units).NumericValue *porosity.NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="UnitWeightOfWater"/> class. /// </summary> /// <param name="waterWeight">W_w in gamma_w=W_w/V_w.</param> /// <param name="waterVolume">V_w in gamma_w=W_w/V_w.</param> /// <param name="units">Measurement system to hold value in after calculation.</param> public UnitWeightOfWater(WeightOfWater waterWeight, WaterVolume waterVolume, UnitWeightUnits units) : this(ConvertToUnits(new BaseUnitWeightScalar("𝛾", BaseWeightScalar.ConvertToUnits(waterWeight, WeightUnits.Kilograms).NumericValue / BaseVolumeScalar.ConvertToUnits(waterVolume, VolumeUnits.CubicMeters).NumericValue, UnitWeightUnits.KilogramPerMeterCubed), units).NumericValue, units) { }
/// <summary> /// Initializes a new instance of the <see cref="TotalUnitWeight"/> class. /// </summary> /// <param name="totalWeight">W in gamma_t=W/V.</param> /// <param name="totalVolume">V in gamma_t=W/V.</param> /// <param name="units">Measurement unit to use after construction from formula (ie g/cc).</param> public TotalUnitWeight(TotalWeight totalWeight, TotalVolume totalVolume, UnitWeightUnits units) : this(ConvertToUnits(new BaseUnitWeightScalar("𝛾", BaseWeightScalar.ConvertToUnits(totalWeight, WeightUnits.Kilograms).NumericValue / BaseVolumeScalar.ConvertToUnits(totalVolume, VolumeUnits.CubicMeters).NumericValue, UnitWeightUnits.KilogramPerMeterCubed), units).NumericValue, units) { }