# HG changeset patch # User Raimund Renkert # Date 1358690539 -3600 # Node ID bf2fd9c58ac4f775eac30baefb1d9c737911f3d7 # Parent a7d080347ac3e2d82af94f78b1518f711ce602d8 Fixed MINFO SQ calculation. * Fixed calculation of sieve 8. * Fixed calculation of 'Geschiebetransport'. * Fixed calculation of fractions (Sand, gravel, coarse). diff -r a7d080347ac3 -r bf2fd9c58ac4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java Fri Jan 11 13:57:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java Sun Jan 20 15:02:19 2013 +0100 @@ -11,11 +11,11 @@ private static final Log log = LogFactory.getLog(Measurement.class); - public static final double ADD_8 = Math.log(10) - Math.log(8)/Math.log(6.3); - public static final double SCALE_8 = Math.log(6.3); + public static final double LOG_10_8 = Math.log(10) - Math.log(8); + public static final double SCALE_8 = Math.log(10) - Math.log(6.3); - public static final double ADD_4 = Math.log(8) - Math.log(6.3)/Math.log(10); - public static final double SCALE_4 = Math.log(6.3); + public static final double LOG_8_6 = Math.log(8) - Math.log(6.3); + public static final double SCALE_4 = Math.log(10) - Math.log(6.3); protected Map data; @@ -123,6 +123,7 @@ if (sieveArray == null) { sieveArray = calculateSieveArray(); } + adjustSieves(); return sieveArray; } @@ -171,11 +172,15 @@ deleteSieve(6.3); - double eightValue = ADD_8 - SCALE_8*sixValue + tenValue; - double newFourValue = ADD_4 - SCALE_4*sixValue + fourValue; + double eightValue = ((LOG_10_8 / SCALE_8*sixValue) + tenValue); + double newFourValue = ((LOG_8_6 / SCALE_4*sixValue) + fourValue); + deleteSieve(4.0); sieves.add(new Sieve(8d, eightValue)); sieves.add(new Sieve(4d, newFourValue)); + sieveArray.adjust( + eightValue/sieveArray.totalLoad(), + newFourValue/sieveArray.totalLoad()); } protected SieveArray calculateSieveArray() { diff -r a7d080347ac3 -r bf2fd9c58ac4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java Fri Jan 11 13:57:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java Sun Jan 20 15:02:19 2013 +0100 @@ -1,6 +1,7 @@ package de.intevation.flys.artifacts.model.sq; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.Date; @@ -52,7 +53,7 @@ "g.UFERABLINKS AS UFERABLINKS," + "m.TSCHWEB AS TSCHWEB," + "m.TSAND AS TSAND," + - "gp.GTRIEB AS GTRIEB," + + "gp.GTRIEB_F AS GTRIEB," + "m.TGESCHIEBE AS TGESCHIEBE," + "si.SIEB01 AS SIEB01, si.SIEB02 AS SIEB02," + "si.SIEB03 AS SIEB03, si.SIEB04 AS SIEB04," + @@ -328,10 +329,6 @@ accumulated.add(accumulate(same)); } - for (Measurement m: accumulated) { - m.adjustSieves(); - } - if (debug) { log.debug("Before date separation: " + accumulated.size()); } @@ -459,10 +456,10 @@ if (N == 1) { return measuments.get(0); } - TreeMap diameters = new TreeMap(Sieve.DIAMETER_CMP); + double sumGTrieb = 0d; for (Measurement m: measuments) { for (Sieve s: m.getSieves()) { Double key = s.getDiameter(); @@ -473,6 +470,8 @@ } sum[0] += s.getLoad(); } + // calculate 'Geschiebetrieb' + sumGTrieb += m.get("GTRIEB"); } List accumulatedSieves = new ArrayList(diameters.size()); for (Map.Entry entry: diameters.entrySet()) { @@ -480,10 +479,10 @@ new Sieve(entry.getKey(), entry.getValue()[0]/N)); } - Map data = new HashMap(measuments.get(0).getData()); + data.put("GTRIEB", sumGTrieb/N); return new Measurement(data, accumulatedSieves); } } diff -r a7d080347ac3 -r bf2fd9c58ac4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SieveArray.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SieveArray.java Fri Jan 11 13:57:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/SieveArray.java Sun Jan 20 15:02:19 2013 +0100 @@ -51,6 +51,11 @@ } } + public void adjust(double eight, double four) { + this.normLoads[4] = eight; + this.normLoads[5] = four; + } + /** * Gets the loads for this instance. * @@ -91,7 +96,7 @@ public double sandNormFraction() { double sum = 0d; - for (int i = 8; i < normLoads.length; ++i) { + for (int i = 7; i < normLoads.length; ++i) { sum += normLoads[i]; } return sum; @@ -107,7 +112,7 @@ public double gravelNormFraction() { double sum = 0d; - for (int i = 4; i < 8; ++i) { + for (int i = 4; i < 7; ++i) { sum += normLoads[i]; } return sum;