Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java @ 8948:a4f1ac81f26d
Work on SINFO-FlowDepthMinMax.
Also rework of result row stuff, in order to reduce abstraction, using result type concept
author | gernotbelger |
---|---|
date | Wed, 14 Mar 2018 14:10:32 +0100 |
parents | 5d5d482da3e9 |
children | 183f42641ab6 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Wed Mar 14 14:09:33 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java Wed Mar 14 14:10:32 2018 +0100 @@ -14,6 +14,8 @@ import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultRow; +import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder; import org.dive4elements.river.model.River; @@ -144,57 +146,67 @@ } } - public Tkh getTkh(final double km) { + public void calculateTkh(final double km, final SInfoResultRow row) { + + row.putValue(SInfoResultType.station, km); final SoilKind kind = getSoilKind(km); + row.putValue(SInfoResultType.soilkind, kind); final double wst = this.waterlevelProvider.getWaterlevel(km); + row.putValue(SInfoResultType.waterlevel, wst); final double meanBedHeight = this.bedHeightsProvider.getMeanBedHeight(km); + row.putValue(SInfoResultType.meanBedHeight, meanBedHeight); final double flowDepth = wst - meanBedHeight; + row.putValue(SInfoResultType.flowdepth, flowDepth); final double discharge = this.dischargeProvider.getDischarge(km); + row.putValue(SInfoResultType.discharge, discharge); if (Double.isNaN(discharge)) - return new Tkh(km, wst, meanBedHeight, flowDepth, Double.NaN, kind); + return; if (!this.hasTkh()) - return new Tkh(km, wst, meanBedHeight, flowDepth, Double.NaN, kind); + return; final double d50 = getBedMeasurement(km); if (Double.isNaN(d50)) - return new Tkh(km, wst, meanBedHeight, flowDepth, discharge, kind); + return; + row.putValue(SInfoResultType.d50, d50); if (!this.flowVelocitiesFinder.findKmQValues(km, discharge)) { // TODO: ggf. station in Fehlermeldung? final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingVelocity", null, this.problemLabel); this.problems.addProblem(km, message); // FIXME: cumulate problems to one message? - return new Tkh(km, wst, meanBedHeight, flowDepth, discharge, kind); + return; } final double velocity = this.flowVelocitiesFinder.getFindVmainFound(); + row.putValue(SInfoResultType.velocity, velocity); + final double tau = this.flowVelocitiesFinder.getFindTauFound(); + row.putValue(SInfoResultType.tau, tau); final double tkh = calculateTkh(wst - meanBedHeight, velocity, d50, tau); - double tkhUp; - double tkhDown; + row.putValue(SInfoResultType.tkh, tkh); + switch (kind) { case starr: - tkhUp = tkh; - tkhDown = 0; + row.putValue(SInfoResultType.tkhup, tkh); + row.putValue(SInfoResultType.tkhdown, 0.0); break; case mobil: default: - tkhUp = tkh / 2; - tkhDown = -tkh / 2; + row.putValue(SInfoResultType.tkhup, tkh / 2); + row.putValue(SInfoResultType.tkhdown, -tkh / 2); break; } - final double flowDepthTkh = calculateFlowDepthTkh(tkhUp, kind, wst, meanBedHeight); - - return new Tkh(km, wst, meanBedHeight, flowDepth, flowDepthTkh, discharge, kind, tkh, tkhUp, tkhDown, velocity, d50, tau); + final double flowDepthTkh = calculateFlowDepthTkh(tkh, kind, wst, meanBedHeight); + row.putValue(SInfoResultType.flowdepthtkh, flowDepthTkh); } /**