Package io.openems.common.utils
Class DoubleUtils
- java.lang.Object
-
- io.openems.common.utils.DoubleUtils
-
public class DoubleUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DoubleUtils()
-
Method Summary
All Methods Static Methods Concrete Methods 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].
-
-
-
Method Detail
-
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 normalizedminValue
- 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
-
-