Mercurial > dive4elements > river
changeset 9443:515643b2c49a
Added computation of uinfo salix line vegetation zone height (not yet connected to the cross section facet)
author | mschaefer |
---|---|
date | Mon, 20 Aug 2018 18:50:33 +0200 |
parents | 173f188569c6 |
children | ecadc9ed0ba0 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties |
diffstat | 4 files changed, 47 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java Mon Aug 20 18:20:15 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java Mon Aug 20 18:50:33 2018 +0200 @@ -22,6 +22,7 @@ import org.dive4elements.river.artifacts.common.IExportContext; import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; import org.dive4elements.river.artifacts.common.ResultRow; +import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.uinfo.common.UInfoResultType; import org.dive4elements.river.artifacts.uinfo.salix.SalixLineCrossSectionIndexData.SalixWaterlevel; @@ -223,4 +224,15 @@ throw new UnsupportedOperationException(); } } + + /** + * Computes the height of a vegetation zone type for a station and a salix calculation result + */ + public double computeVegetationZoneHeight(final double station, final int vegetationZoneType, final SalixLineCalculationResult result) { + + final Calculation problems = new Calculation(); + + final SalixLineCalculator calculator = new SalixLineCalculator(null); + return calculator.computeVegetationZoneHeight(problems, station, vegetationZoneType, result); + } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java Mon Aug 20 18:20:15 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java Mon Aug 20 18:50:33 2018 +0200 @@ -32,6 +32,7 @@ import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; import org.dive4elements.river.artifacts.uinfo.common.UInfoResultType; import org.dive4elements.river.artifacts.uinfo.salix.SalixLineAccess.ScenarioType; +import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneServerClientXChange; import org.dive4elements.river.model.Gauge; import org.dive4elements.river.model.MainValue; import org.dive4elements.river.model.MainValueType.MainValueTypeKey; @@ -249,4 +250,28 @@ } return null; } -} \ No newline at end of file + + /** + * Computes the height of a vegetation zone limit for a station and a previously computed salix line result + */ + public double computeVegetationZoneHeight(final Calculation problems, final double station, final int vegetationZoneType, + final SalixLineCalculationResult result) { + + // Search the station in the previously calculated result rows + final ResultRow stationRow = searchStation(station, result.getRows()); + if (stationRow == null) + return Double.NaN; + // Compute height from overflow duration days + final List<VegetationZoneServerClientXChange> vzs = VegetationZoneServerClientXChange.getStandardList(null, null); // TODO river, context + if ((vegetationZoneType >= 1) && (vegetationZoneType <= vzs.size())) { + final int uefd = vzs.get(vegetationZoneType - 1).getMin_day_overflow(); + // Üfd = -70,559 ∗ ln((DGM - MW) + 0,5) + 80,711 + final double f1 = -70.559; + final double f2 = -88.711; + final double mw = stationRow.getDoubleValue(UInfoResultType.waterlevelMW); + final double dgm = Math.exp((uefd - f2) / f1) + mw - 0.5; + return dgm; + } + return Double.NaN; + } +}
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java Mon Aug 20 18:20:15 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneServerClientXChange.java Mon Aug 20 18:50:33 2018 +0200 @@ -16,6 +16,8 @@ import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.model.River; +import org.dive4elements.river.model.uinfo.VegetationType; +import org.dive4elements.river.model.uinfo.VegetationZone; /** * @author Domenico Nardi Tironi @@ -91,11 +93,15 @@ return this.min_day_overflow; } + public static String getLocalizedVegetationTypeName(final CallContext context, final VegetationType zonetype) { + return Resources.getMsg(context.getMeta(), "uinfo_vegetation_type_" + zonetype.getId().toString()); + } + public static final List<VegetationZoneServerClientXChange> getStandardList(final River river, final CallContext context) { final List<VegetationZoneServerClientXChange> list = new ArrayList<>(); - for (final org.dive4elements.river.model.uinfo.VegetationZone vz : org.dive4elements.river.model.uinfo.VegetationZone.getValues(river)) { - final String zn = Resources.getMsg(context.getMeta(), "uinfo_vegetation_type_" + vz.getVegetationType().getId().toString()); + for (final VegetationZone vz : VegetationZone.getValues(river)) { + final String zn = getLocalizedVegetationTypeName(context, vz.getVegetationType()); list.add(new VegetationZoneServerClientXChange(zn, vz.getMin_overflow_days(), vz.getMax_overflow_days(), vz.getColor())); } return list;
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Mon Aug 20 18:20:15 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Mon Aug 20 18:50:33 2018 +0200 @@ -850,7 +850,7 @@ uinfo_salix_km_has_gaps = Der Km-Bereich ist nicht vollst. belegt. uinfo_salix_km_anschluss = Der eingegebene Bereich schlie\u00dft nicht an den letzten Wert an. uinfo_salix_input_complete = Die gesamte Strecke ist bereits mit Werten belegt. -uinfo_salix_lines = Iotasn +uinfo_salix_lines = Iota uinfo_salix_line = Iota - L\u00e4ngsschnitt bundu = Betrieb und Unterhaltung