diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/fitting/TargetFunction.java @ 9646:0380717105ba

Implemented alternative fitting strategy for Log-Linear function.
author Gernot Belger <g.belger@bjoernsen.de>
date Mon, 02 Dec 2019 17:56:15 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/fitting/TargetFunction.java	Mon Dec 02 17:56:15 2019 +0100
@@ -0,0 +1,31 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.artifacts.model.fixings.fitting;
+
+/**
+ * @author Gernot Belger
+ */
+final class TargetFunction {
+
+    private final double[] discharge;
+
+    public TargetFunction(final double[] discharge) {
+        this.discharge = discharge;
+    }
+
+    public double[] calc_stages(final double a, final double b, final double m) {
+
+        final double[] waterlevels = new double[this.discharge.length];
+        for (int i = 0; i < this.discharge.length; i++)
+            waterlevels[i] = a * Math.log(b + m * this.discharge[i]);
+
+        return waterlevels;
+    }
+}
\ No newline at end of file

http://dive4elements.wald.intevation.org