Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java @ 9430:e8b1255fc89e
Added calculation of salix hw5 and salix line w
author | mschaefer |
---|---|
date | Mon, 20 Aug 2018 09:41:07 +0200 |
parents | bd5f5d2220fa |
children | 515643b2c49a |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java Fri Aug 17 17:48:01 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java Mon Aug 20 09:41:07 2018 +0200 @@ -52,9 +52,11 @@ private final Map<Gauge, QPosition> gaugeMwPos; private final Map<Gauge, QPosition> gaugeMnwPos; private final Map<Gauge, QPosition> gaugeMhwPos; + private final Map<Gauge, QPosition> gaugeHw5Pos; private QPosition refGaugeMwPos; private QPosition refGaugeMnwPos; private QPosition refGaugeMhwPos; + private QPosition refGaugeHw5Pos; private Gauge firstGauge; private Calculation problems; @@ -66,6 +68,7 @@ this.gaugeMwPos = new HashMap<>(); this.gaugeMnwPos = new HashMap<>(); this.gaugeMhwPos = new HashMap<>(); + this.gaugeHw5Pos = new HashMap<>(); } /** @@ -103,11 +106,14 @@ this.gaugeMwPos.clear(); this.gaugeMnwPos.clear(); this.gaugeMhwPos.clear(); + this.gaugeHw5Pos.clear(); + this.firstGauge = null; for (final Gauge gauge : this.riverInfoProvider.getGauges()) { this.gaugeMwPos.put(gauge, null); this.gaugeMnwPos.put(gauge, null); this.gaugeMhwPos.put(gauge, null); + this.gaugeHw5Pos.put(gauge, null); final double gaugeKm = gauge.getStation().doubleValue(); for (final MainValue mv : MainValue.getValuesOfGaugeAndType(gauge, MainValueTypeKey.Q)) { if (mv.getMainValue().getName().equalsIgnoreCase("mq")) @@ -116,11 +122,14 @@ this.gaugeMnwPos.put(gauge, this.wst.getQPosition(gaugeKm, mv.getValue().doubleValue())); else if (mv.getMainValue().getName().equalsIgnoreCase("mhq")) this.gaugeMhwPos.put(gauge, this.wst.getQPosition(gaugeKm, mv.getValue().doubleValue())); + else if (mv.getMainValue().getName().equalsIgnoreCase("hq5")) + this.gaugeHw5Pos.put(gauge, this.wst.getQPosition(gaugeKm, mv.getValue().doubleValue())); } if (this.firstGauge == null) { this.refGaugeMwPos = this.gaugeMwPos.get(gauge); this.refGaugeMnwPos = this.gaugeMnwPos.get(gauge); this.refGaugeMhwPos = this.gaugeMhwPos.get(gauge); + this.refGaugeHw5Pos = this.gaugeHw5Pos.get(gauge); this.firstGauge = gauge; } } @@ -150,22 +159,23 @@ final double mnw = interpolateW(station, this.refGaugeMnwPos); final double mw = interpolateW(station, this.refGaugeMwPos); final double mhw = interpolateW(station, this.refGaugeMhwPos); + final double hw5 = interpolateW(station, this.refGaugeHw5Pos); row.putValue(UInfoResultType.waterlevelMNW, mnw); row.putValue(UInfoResultType.waterlevelMW, mw); row.putValue(UInfoResultType.waterlevelMHW, mhw); - // TODO: hier noch den W(HQ5) - row.putValue(UInfoResultType.waterlevelMH5, Double.NaN); + row.putValue(UInfoResultType.waterlevelMH5, hw5); // Calc salix-line and mw-mnw row.putValue(UInfoResultType.salixline, calcSalix(mhw, mw)); row.putValue(UInfoResultType.salix_mw_mnw, calcMwmnw(mw, mnw)); + row.putValue(UInfoResultType.salixw, mhw - SALIX_DISTANCE.doubleValue()); // Calc scenario values (always all scenario types set, Result variant extracts the fields needed) final List<SalixScenario> scenarios = new ArrayList<>(); final List<Double> deltaws = getDeltaWs(station, rangeScenarios); for (final Double deltaw : deltaws) { if (deltaw != null) { final double salix = calcSalix(mhw, mw + deltaw); - scenarios.add(new SalixScenario((int) (deltaw * 100), salix)); + scenarios.add(new SalixScenario((int) (deltaw * 100), salix, mhw + deltaw - SALIX_DISTANCE.doubleValue())); } else { scenarios.add(null);