Class DoubleUtils

java.lang.Object
io.openems.common.utils.DoubleUtils

public class DoubleUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    normalize(double value, double minValue, double maxValue, double minNormalized, double maxNormalized, boolean invert)
    Normalize a value to a range - normalize values between [100, 1000] to range [0, 1].

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DoubleUtils

      public DoubleUtils()
  • Method Details

    • normalize

      public static double normalize(double value, double minValue, double maxValue, double minNormalized, double maxNormalized, boolean invert)
      Normalize a value to a range - normalize values between [100, 1000] to range [0, 1].
      Parameters:
      value - the value to be normalized
      minValue - the minimum possible value (e.g. "200")
      maxValue - the maximum possible value (e.g. "1000")
      minNormalized - the minimum normalized value (e.g. "0")
      maxNormalized - the maximum normalized value (e.g. "1")
      invert - invert the normalization, i.e. 1000 is mapped to 0 and 200 is mapped to 1
      Returns:
      the normalized value