Esempio n. 1
0
        /// <summary>Converst PH to water units.</summary>
        /// <param name="ph">The ph.</param>
        /// <param name="units">The current units.</param>
        /// <returns>The converted values</returns>
        private static double[] PHWater(double[] ph, Sample.PHSampleUnitsEnum units)
        {
            if (units == Sample.PHSampleUnitsEnum.Water || ph == null)
            {
                return(ph);
            }

            // pH in water = (pH in CaCl X 1.1045) - 0.1375
            return(MathUtilities.Subtract_Value(MathUtilities.Multiply_Value(ph, 1.1045), 0.1375));
        }
Esempio n. 2
0
 /// <summary>Phes the units set.</summary>
 /// <param name="ToUnits">To units.</param>
 public void PHUnitsSet(Sample.PHSampleUnitsEnum ToUnits)
 {
     if (ToUnits != PHUnits)
     {
         // convert the numbers
         if (ToUnits == Sample.PHSampleUnitsEnum.Water)
         {
             // pH in water = (pH in CaCl X 1.1045) - 0.1375
             PH = MathUtilities.Subtract_Value(MathUtilities.Multiply_Value(PH, 1.1045), 0.1375);
         }
         else
         {
             // pH in CaCl = (pH in water + 0.1375) / 1.1045
             PH = MathUtilities.Divide_Value(MathUtilities.AddValue(PH, 0.1375), 1.1045);
         }
         PHUnits = ToUnits;
     }
 }