
nl.tno.bim.nmd.scaling.NmdLogarithmicScaler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bimnmdservice Show documentation
Show all versions of bimnmdservice Show documentation
provides a REST api for retrieving nmd data from various data sources
The newest version!
package nl.tno.bim.nmd.scaling;
import java.util.InputMismatchException;
public class NmdLogarithmicScaler extends NmdBaseScaler implements NmdScaler {
public NmdLogarithmicScaler(String scaleUnit, Double[] coefficients, Double[] bounds, Double[] currentValues) throws InputMismatchException {
super(scaleUnit, coefficients, bounds, currentValues);
if (currentValues[0] == 1 || currentValues[1] == 1) {
throw new InputMismatchException(
"Cannot have a unit value for a logarithmic scaler as it creates a division by 0 error on scaling");
}
}
@Override
protected Double calculate(Double x) {
if (x == 0.0) {
return Double.NaN;
}
return coefficients[0] * Math.log(x) + coefficients[2];
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy