Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9438:d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
author | mschaefer |
---|---|
date | Mon, 20 Aug 2018 16:05:06 +0200 |
parents | 751a3eff6244 |
children | ecadc9ed0ba0 |
rev | line source |
---|---|
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
9313 | 2 * Software engineering by |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
10 |
9313 | 11 package org.dive4elements.river.artifacts.bundu.bezugswst; |
12 | |
13 import java.util.ArrayList; | |
14 import java.util.List; | |
15 | |
16 import org.dive4elements.artifacts.CallContext; | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
17 import org.dive4elements.river.artifacts.access.FixRealizingAccess; |
9313 | 18 import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9313
diff
changeset
|
19 import org.dive4elements.river.artifacts.bundu.BunduResultType; |
9313 | 20 import org.dive4elements.river.artifacts.common.GeneralResultType; |
21 import org.dive4elements.river.artifacts.common.ResultRow; | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
22 import org.dive4elements.river.artifacts.model.Calculation; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
23 import org.dive4elements.river.artifacts.model.Calculation.Problem; |
9313 | 24 import org.dive4elements.river.artifacts.model.CalculationResult; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
25 import org.dive4elements.river.artifacts.model.WQKms; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
26 import org.dive4elements.river.artifacts.model.fixings.FixRealizingCalculation; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
27 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; |
9313 | 28 import org.dive4elements.river.artifacts.resources.Resources; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
29 import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
30 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
31 import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
32 import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper; |
9313 | 33 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; |
34 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
9323 | 35 import org.dive4elements.river.artifacts.sinfo.util.WstInfo; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
36 import org.dive4elements.river.exports.WaterlevelDescriptionBuilder; |
9313 | 37 import org.dive4elements.river.model.River; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
38 import org.dive4elements.river.utils.Formatter; |
9313 | 39 |
40 class BezugswstCalculation { | |
41 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
42 // private static Logger log = Logger.getLogger(BezugswstCalculation.class); |
9313 | 43 |
44 private final CallContext context; | |
45 | |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
46 |
9313 | 47 public BezugswstCalculation(final CallContext context) { |
48 this.context = context; | |
49 } | |
50 | |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
51 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
52 /** |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
53 * Calculates the result rows of a bundu bzws workflow |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
54 */ |
9313 | 55 public CalculationResult calculate(final BUNDUArtifact bunduartifact) { |
56 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
57 // Get input data |
9313 | 58 final String user = CalculationUtils.findArtifactUser(this.context, bunduartifact); |
59 final BunduAccess access = new BunduAccess(bunduartifact); | |
60 final River river = access.getRiver(); | |
61 final RiverInfo riverInfo = new RiverInfo(river); | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
62 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), "bundu_bezugswst"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
63 final boolean preprocessing = access.getPreprocessing(); |
9323 | 64 final int startYear = access.getStartYear(); |
65 final int endYear = access.getBezugsJahr(); | |
66 final Integer ud = access.getUd(); | |
67 final Double missingVolFrom = access.getMissingVolFrom(); | |
68 final Double missingVolTo = access.getMissingVolTo(); | |
9330
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
69 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
70 final BezugswstCalculationResults results = new BezugswstCalculationResults(calcModeLabel, user, riverInfo, access.getRange()); |
9330
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
71 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
72 final Calculation problems = new Calculation(); |
9331 | 73 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
74 // Calculate the wspl for the selected river range as in fixa awspl |
9437 | 75 bunduartifact.addStringData("wq_isq", "true"); // macht doch Sinn hier, sorry! |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
76 final WinfoArtifactWrapper winfo = new WinfoArtifactWrapper(bunduartifact); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
77 final RiverInfoProvider riverInfoProvider = RiverInfoProvider.forRange(this.context, river, access.getRange(), true); |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
78 final FixRealizingResult fixResult = calculateWspl(bunduartifact, problems); |
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
79 if (fixResult == null) |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
80 return new CalculationResult(results, problems); |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
81 |
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
82 final WQKms wqkms = fixResult.getWQKms()[0]; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
83 final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider.getReferenceGauge(), true); |
9331 | 84 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
85 // Fetch the bed heights of the selected sounding |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
86 final int bedHeightId = access.getBedHeightID(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
87 final BedHeightsFinder bedHeightsFinder = BedHeightsFinder.forId(problems, bedHeightId, access.getRange()); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
88 if (bedHeightsFinder == null) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
89 return new CalculationResult(results, problems); |
9332 | 90 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
91 // Fetch the river channel data |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
92 final ChannelFinder channelFinder = ChannelFinder.loadValues(problems, river, access.getBezugsJahr()); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
93 if (channelFinder == null) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
94 return new CalculationResult(results, problems); |
9332 | 95 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
96 // Calculate the result rows |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
97 final List<ResultRow> rows = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
98 for (int i = 0; i <= wqkms.size() - 1; i++) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
99 rows.add(createRow(wqkms.getKm(i), wqkms.getW(i), wqkms.getQ(i), bedHeightsFinder, channelFinder, riverInfoProvider, wstInfo)); |
9330
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
100 } |
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
101 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
102 // Add the result to the results collection |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
103 final WaterlevelDescriptionBuilder descBuilder = new WaterlevelDescriptionBuilder(winfo, this.context); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
104 final String qtext = descBuilder.getMetadataQ(); |
9436 | 105 final BezugswstMainCalculationResult result = new BezugswstMainCalculationResult("bundu-bzws", rows, bedHeightsFinder.getInfo(), wstInfo, |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
106 access.getFunction(), preprocessing, startYear, endYear, ud, qtext, wqkms, missingVolFrom, missingVolTo); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
107 results.addResult(result, problems); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
108 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
109 // // missing volume calculation |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
110 // if (access.getMissingVolFrom() != null) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
111 // /// FIRST RESULT |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
112 // final List<ResultRow> listResult1 = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
113 // final ResultRow rowResult1 = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
114 // rowResult1.putValue(BunduResultType.bezugswst, 45.15); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
115 // rowResult1.putValue(GeneralResultType.dischargeQwithUnit, 890); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
116 // rowResult1.putValue(GeneralResultType.waterlevelLabel, "GLQ"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
117 // rowResult1.putValue(GeneralResultType.gaugeLabel, "Bonn"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
118 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
119 // rowResult1.putValue(BunduResultType.sounding, "NIEDERRHEIN_QP-2002"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
120 // rowResult1.putValue(BunduResultType.channelLowerEdge, 42.65); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
121 // rowResult1.putValue(BunduResultType.channelMinDepth, 2.5); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
122 // rowResult1.putValue(BunduResultType.hasMissingDepth, Resources.getMsg(meta, "true")); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
123 // rowResult1.putValue(BunduResultType.missVolume, 2250); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
124 // rowResult1.putValue(BunduResultType.missMass, 3897); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
125 // rowResult1.putValue(BunduResultType.excavationVolume, 2475); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
126 // rowResult1.putValue(BunduResultType.excavationCosts, 999.99); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
127 // rowResult1.putValue(BunduResultType.channelWidth, 150); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
128 // rowResult1.putValue(BunduResultType.density, 1732); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
129 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
130 // rowResult1.putValue(GeneralResultType.location, "Spitzenlage"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
131 // listResult1.add(rowResult1); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
132 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
133 // final BezugswstMissVolCalculationResult1 r1 = new BezugswstMissVolCalculationResult1( |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
134 // Resources.getMsg(meta, "bundu.export.csv.title.bezugswst.result1"), listResult1); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
135 // results.addResult(r1, null); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
136 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
137 // // SECOND RESULT |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
138 // final List<ResultRow> listResult2 = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
139 // final ResultRow rowResult2 = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
140 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
141 // rowResult2.putValue(GeneralResultType.station, 890); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
142 // final List<String> fieldValues = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
143 // fieldValues.add("444 [m³] / 765 [t]"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
144 // fieldValues.add("4.444 [m³] / 1.765 [t]"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
145 // fieldValues.add("444 [m³] / 765 [t]"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
146 // fieldValues.add(""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
147 // fieldValues.add(""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
148 // fieldValues.add(""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
149 // fieldValues.add(""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
150 // fieldValues.add(""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
151 // fieldValues.add(""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
152 // fieldValues.add("444 [m³] / 765 [t]"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
153 // rowResult2.putValue(BunduResultType.fields, fieldValues); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
154 // rowResult2.putValue(BunduResultType.meanBedheight, "9.444 [m³] / 8.765 [t]"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
155 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
156 // listResult2.add(rowResult2); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
157 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
158 // final BezugswstMissVolCalculationResult2 r2 = new BezugswstMissVolCalculationResult2( |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
159 // Resources.getMsg(meta, "bundu.export.csv.title.bezugswst.result2"), listResult2); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
160 // results.addResult(r2, null); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
161 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
162 // // Third RESULT |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
163 // final List<ResultRow> listResult3 = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
164 // final ResultRow rowResult3 = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
165 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
166 // rowResult3.putValue(BunduResultType.stationForMiss, "650 - 651"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
167 // rowResult3.putValue(BunduResultType.missVolume, 52950); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
168 // rowResult3.putValue(BunduResultType.missMass, 91491); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
169 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
170 // listResult3.add(rowResult3); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
171 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
172 // final BezugswstMissVolCalculationResult3 r3 = new BezugswstMissVolCalculationResult3( |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
173 // Resources.getMsg(meta, "bundu.export.csv.title.bezugswst.result3"), listResult3); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
174 // results.addResult(r3, null); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
175 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
176 // } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
177 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
178 return new CalculationResult(results, problems); |
9313 | 179 } |
180 | |
181 /** | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
182 * Calculates a w-q-longitudinal section for a river range and Q specified in an artifact |
9313 | 183 */ |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
184 private FixRealizingResult calculateWspl(final BUNDUArtifact bundu, final Calculation problems) { |
9313 | 185 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
186 final FixRealizingAccess access = new FixRealizingAccess(bundu); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
187 final FixRealizingCalculation calc = new FixRealizingCalculation(access); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
188 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
189 final CalculationResult res = calc.calculate(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
190 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
191 final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
192 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
193 final List<Problem> problems2 = res.getReport().getProblems(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
194 if (problems2 != null) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
195 for (final Problem problem : problems2) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
196 problems.addProblem(problem); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
197 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
198 } |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
199 return fixRes; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
200 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
201 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
202 /** |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
203 * Create a result row for a station |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
204 */ |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
205 private ResultRow createRow(final double station, final double w, final double q, final BedHeightsFinder bedHeightsFinder, |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
206 final ChannelFinder channelFinder, final RiverInfoProvider riverInfoProv, final WstInfo wstInfo) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
207 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
208 final ResultRow row = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
209 row.putValue(GeneralResultType.station, station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
210 row.putValue(BunduResultType.bezugswst, w); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
211 row.putValue(GeneralResultType.dischargeQwithUnit, q); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
212 row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel()); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
213 row.putValue(GeneralResultType.gaugeLabel, riverInfoProv.findGauge(station)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
214 row.putValue(GeneralResultType.location, riverInfoProv.getLocation(station)); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
215 final double msh = bedHeightsFinder.getMeanBedHeight(station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
216 row.putValue(SInfoResultType.meanBedHeight, msh); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
217 if (!Double.isNaN(w) && !Double.isNaN(msh)) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
218 row.putValue(SInfoResultType.flowdepth, Formatter.roundFlowDepth(w).subtract(Formatter.roundFlowDepth(msh)).doubleValue()); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
219 else |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
220 row.putValue(SInfoResultType.flowdepth, Double.NaN); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
221 final double channelDepth = channelFinder.getDepth(station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
222 row.putValue(BunduResultType.channelDepth, channelDepth); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
223 if (!Double.isNaN(w) && !Double.isNaN(channelDepth)) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
224 row.putValue(BunduResultType.channelLowerEdge, Formatter.roundFlowDepth(w).subtract(Formatter.roundFlowDepth(channelDepth)).doubleValue()); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
225 else |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
226 row.putValue(BunduResultType.channelLowerEdge, Double.NaN); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
227 return row; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
228 } |
9313 | 229 } |