Package io.openems.common.utils
Class DoubleUtils
java.lang.Object
io.openems.common.utils.DoubleUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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].
-
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 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
-