Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9444:ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
author | mschaefer |
---|---|
date | Tue, 21 Aug 2018 13:41:18 +0200 |
parents | d2f5375ede26 |
children | e60584f2a531 |
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; |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
37 import org.dive4elements.river.model.BedHeightValueType; |
9313 | 38 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
|
39 import org.dive4elements.river.utils.Formatter; |
9313 | 40 |
41 class BezugswstCalculation { | |
42 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
43 // private static Logger log = Logger.getLogger(BezugswstCalculation.class); |
9313 | 44 |
45 private final CallContext context; | |
46 | |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
47 |
9313 | 48 public BezugswstCalculation(final CallContext context) { |
49 this.context = context; | |
50 } | |
51 | |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
52 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
53 /** |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
54 * 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
|
55 */ |
9313 | 56 public CalculationResult calculate(final BUNDUArtifact bunduartifact) { |
57 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
58 // Get input data |
9313 | 59 final String user = CalculationUtils.findArtifactUser(this.context, bunduartifact); |
60 final BunduAccess access = new BunduAccess(bunduartifact); | |
61 final River river = access.getRiver(); | |
62 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
|
63 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
|
64 final boolean preprocessing = access.getPreprocessing(); |
9323 | 65 final int startYear = access.getStartYear(); |
66 final int endYear = access.getBezugsJahr(); | |
67 final Integer ud = access.getUd(); | |
68 final Double missingVolFrom = access.getMissingVolFrom(); | |
69 final Double missingVolTo = access.getMissingVolTo(); | |
9330
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
70 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
71 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
|
72 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
73 final Calculation problems = new Calculation(); |
9331 | 74 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
75 // Calculate the wspl for the selected river range as in fixa awspl |
9437 | 76 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
|
77 final WinfoArtifactWrapper winfo = new WinfoArtifactWrapper(bunduartifact); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
78 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
|
79 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
|
80 if (fixResult == null) |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
81 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
|
82 |
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
83 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
|
84 final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider.getReferenceGauge(), true); |
9331 | 85 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
86 // 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
|
87 final int bedHeightId = access.getBedHeightID(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
88 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
|
89 if (bedHeightsFinder == null) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
90 return new CalculationResult(results, problems); |
9332 | 91 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
92 // Fetch the river channel data |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
93 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
|
94 if (channelFinder == null) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
95 return new CalculationResult(results, problems); |
9332 | 96 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
97 // Calculate the result rows |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
98 final List<ResultRow> rows = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
99 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
|
100 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
|
101 } |
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
102 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
103 // 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
|
104 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
|
105 final String qtext = descBuilder.getMetadataQ(); |
9436 | 106 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
|
107 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
|
108 results.addResult(result, problems); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
109 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
110 // // missing volume calculation |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
111 // if (access.getMissingVolFrom() != null) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
112 // /// FIRST RESULT |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
113 // final List<ResultRow> listResult1 = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
114 // final ResultRow rowResult1 = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
115 // rowResult1.putValue(BunduResultType.bezugswst, 45.15); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
116 // rowResult1.putValue(GeneralResultType.dischargeQwithUnit, 890); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
117 // rowResult1.putValue(GeneralResultType.waterlevelLabel, "GLQ"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
118 // rowResult1.putValue(GeneralResultType.gaugeLabel, "Bonn"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
119 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
120 // 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
|
121 // rowResult1.putValue(BunduResultType.channelLowerEdge, 42.65); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
122 // rowResult1.putValue(BunduResultType.channelMinDepth, 2.5); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
123 // 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
|
124 // rowResult1.putValue(BunduResultType.missVolume, 2250); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
125 // rowResult1.putValue(BunduResultType.missMass, 3897); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
126 // rowResult1.putValue(BunduResultType.excavationVolume, 2475); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
127 // rowResult1.putValue(BunduResultType.excavationCosts, 999.99); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
128 // rowResult1.putValue(BunduResultType.channelWidth, 150); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
129 // rowResult1.putValue(BunduResultType.density, 1732); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
130 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
131 // rowResult1.putValue(GeneralResultType.location, "Spitzenlage"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
132 // listResult1.add(rowResult1); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
133 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
134 // final BezugswstMissVolCalculationResult1 r1 = new BezugswstMissVolCalculationResult1( |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
135 // 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
|
136 // results.addResult(r1, null); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
137 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
138 // // SECOND RESULT |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
139 // final List<ResultRow> listResult2 = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
140 // final ResultRow rowResult2 = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
141 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
142 // rowResult2.putValue(GeneralResultType.station, 890); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
143 // final List<String> fieldValues = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
144 // fieldValues.add("444 [m³] / 765 [t]"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
145 // 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
|
146 // fieldValues.add("444 [m³] / 765 [t]"); |
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(""); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
153 // fieldValues.add("444 [m³] / 765 [t]"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
154 // rowResult2.putValue(BunduResultType.fields, fieldValues); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
155 // 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
|
156 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
157 // listResult2.add(rowResult2); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
158 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
159 // final BezugswstMissVolCalculationResult2 r2 = new BezugswstMissVolCalculationResult2( |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
160 // 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
|
161 // results.addResult(r2, null); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
162 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
163 // // Third RESULT |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
164 // final List<ResultRow> listResult3 = new ArrayList<>(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
165 // final ResultRow rowResult3 = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
166 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
167 // rowResult3.putValue(BunduResultType.stationForMiss, "650 - 651"); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
168 // rowResult3.putValue(BunduResultType.missVolume, 52950); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
169 // rowResult3.putValue(BunduResultType.missMass, 91491); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
170 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
171 // listResult3.add(rowResult3); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
172 // |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
173 // final BezugswstMissVolCalculationResult3 r3 = new BezugswstMissVolCalculationResult3( |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
174 // 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
|
175 // results.addResult(r3, null); |
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 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
179 return new CalculationResult(results, problems); |
9313 | 180 } |
181 | |
182 /** | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
183 * Calculates a w-q-longitudinal section for a river range and Q specified in an artifact |
9313 | 184 */ |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
185 private FixRealizingResult calculateWspl(final BUNDUArtifact bundu, final Calculation problems) { |
9313 | 186 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
187 final FixRealizingAccess access = new FixRealizingAccess(bundu); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
188 final FixRealizingCalculation calc = new FixRealizingCalculation(access); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
189 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
190 final CalculationResult res = calc.calculate(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
191 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
192 final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
193 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
194 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
|
195 if (problems2 != null) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
196 for (final Problem problem : problems2) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
197 problems.addProblem(problem); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
198 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
199 } |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
200 return fixRes; |
9432
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 /** |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
204 * 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
|
205 */ |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
206 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
|
207 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
|
208 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
209 final ResultRow row = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
210 row.putValue(GeneralResultType.station, station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
211 row.putValue(BunduResultType.bezugswst, w); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
212 row.putValue(GeneralResultType.dischargeQwithUnit, q); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
213 row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel()); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
214 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
|
215 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
|
216 final double msh = bedHeightsFinder.getMeanBedHeight(station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
217 row.putValue(SInfoResultType.meanBedHeight, msh); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
218 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
|
219 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
|
220 else |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
221 row.putValue(SInfoResultType.flowdepth, Double.NaN); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
222 final double channelDepth = channelFinder.getDepth(station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
223 row.putValue(BunduResultType.channelDepth, channelDepth); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
224 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
|
225 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
|
226 else |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
227 row.putValue(BunduResultType.channelLowerEdge, Double.NaN); |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
228 final List<Double> fieldHeights = new ArrayList<>(); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
229 final List<Double> fieldDepths = new ArrayList<>(); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
230 for (int i = BedHeightValueType.FIELD_FIRST_INDEX; i <= BedHeightValueType.FIELD_LAST_INDEX; i++) { |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
231 final double h = bedHeightsFinder.getFieldHeight(station, i); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
232 fieldHeights.add(Double.valueOf(h)); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
233 fieldDepths.add(w - h); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
234 } |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
235 row.putValue(BunduResultType.bedHeightFields, fieldHeights); |
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
236 row.putValue(BunduResultType.depthFields, fieldDepths); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
237 return row; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
238 } |
9313 | 239 } |