Exemple #1
0
        /// <summary>
        /// Set the volume directly
        /// </summary>
        /// <param name="vol"></param>
        /// <param name="cellArea"></param>
        /// <param name="projectUnits">WARNING: Must always pass in the GCD project units.</param>
        /// <returns></returns>
        /// <remarks>Never pass in display units or any other units than the project units because
        /// _sum member variable is stored in the project vertical units.</remarks>
        public void SetVolume(Volume vol, Area cellArea, UnitGroup projectUnits)
        {
            double volMetres  = vol.As(VolumeUnit.CubicMeter);
            double areaMetres = cellArea.As(AreaUnit.SquareMeter);

            _sum = Length.From(volMetres / areaMetres, LengthUnit.Meter).As(projectUnits.VertUnit);
        }
Exemple #2
0
                    1.2, VolumeUnit.Liter)]     // 1.2 L of solution required for obtaining 0.1142805 Moles/L from 5g HCl
        public void VolumeSolutionFromComponentMassAndDesiredConcentration(
            double componentMassValue, MassUnit componentMassUnit,
            double componentMolarMassValue, MolarMassUnit componentMolarMassUnit,
            double desiredMolarityValue, MolarityUnit desiredMolarityUnit,
            double expectedSolutionVolumeValue, VolumeUnit expectedSolutionVolumeUnit, double tolerence = 1e-5)
        {
            var componentMass      = new Mass(componentMassValue, componentMassUnit);
            var componentMolarMass = new MolarMass(componentMolarMassValue, componentMolarMassUnit);
            var desiredMolarity    = new Molarity(desiredMolarityValue, desiredMolarityUnit);
            AmountOfSubstance amountOfSubstance = componentMass / componentMolarMass;

            Volume volumeSolution = amountOfSubstance / desiredMolarity;

            AssertEx.EqualTolerance(expectedSolutionVolumeValue, volumeSolution.As(expectedSolutionVolumeUnit), tolerence);
        }