annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9432:d194c5b24bf8

Added bundu bzws w calculation and longitudinal sections of wspl and depth
author mschaefer
date Mon, 20 Aug 2018 09:46:02 +0200
parents 66c7f2defc80
children 9f57d2396360
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
2 * Software engineering by
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
5 *
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
9 */
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
10
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
11 package org.dive4elements.river.artifacts.bundu.bezugswst;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
12
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
13 import java.util.ArrayList;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
14 import java.util.List;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
15
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
20 import org.dive4elements.river.artifacts.common.GeneralResultType;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
33 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
34 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
9323
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
39
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
40 class BezugswstCalculation {
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
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
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
43
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
44 private final CallContext context;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
45
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
46 public BezugswstCalculation(final CallContext context) {
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
47 this.context = context;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
48 }
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
49
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
50 /**
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
51 * 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
52 */
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
53 public CalculationResult calculate(final BUNDUArtifact bunduartifact) {
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
54
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
55 // Get input data
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
56 final String user = CalculationUtils.findArtifactUser(this.context, bunduartifact);
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
57 final BunduAccess access = new BunduAccess(bunduartifact);
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
58 final River river = access.getRiver();
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
59 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
60 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
61 final boolean preprocessing = access.getPreprocessing();
9323
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
62 final int startYear = access.getStartYear();
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
63 final int endYear = access.getBezugsJahr();
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
64 final Integer ud = access.getUd();
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
65 final Double missingVolFrom = access.getMissingVolFrom();
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
66 final Double missingVolTo = access.getMissingVolTo();
9330
0a0937f33bb5 bundu.bezugswst first result for missing volume added
gernotbelger
parents: 9323
diff changeset
67
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
68 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
69
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
70 final Calculation problems = new Calculation();
9331
127638669052 bundu bezugswst result 2
gernotbelger
parents: 9330
diff changeset
71
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
72 // Calculate the wspl for the selected river range as in fixa awspl
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
73 bunduartifact.addStringData("wq_isq", "true");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
74 final WinfoArtifactWrapper winfo = new WinfoArtifactWrapper(bunduartifact);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
75 final RiverInfoProvider riverInfoProvider = RiverInfoProvider.forRange(this.context, river, access.getRange(), true);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
76 final WQKms wqkms = calculateWspl(bunduartifact, problems);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
77 if (wqkms == null)
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
78 return new CalculationResult(results, problems);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
79 final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider.getReferenceGauge(), true);
9331
127638669052 bundu bezugswst result 2
gernotbelger
parents: 9330
diff changeset
80
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
81 // 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
82 final int bedHeightId = access.getBedHeightID();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
83 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
84 if (bedHeightsFinder == null)
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
85 return new CalculationResult(results, problems);
9332
c64de8cc4e97 bundu.bezugswst missing volume calcResult3
gernotbelger
parents: 9331
diff changeset
86
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
87 // Fetch the river channel data
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
88 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
89 if (channelFinder == 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
c64de8cc4e97 bundu.bezugswst missing volume calcResult3
gernotbelger
parents: 9331
diff changeset
91
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
92 // Calculate the result rows
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
93 final List<ResultRow> rows = new ArrayList<>();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
94 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
95 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
96 }
0a0937f33bb5 bundu.bezugswst first result for missing volume added
gernotbelger
parents: 9323
diff changeset
97
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
98 // 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
99 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
100 final String qtext = descBuilder.getMetadataQ();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
101 final BezugswstMainCalculationResult result = new BezugswstMainCalculationResult("bundu-bzws", rows, bedHeightsFinder.getInfo(),
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
102 wstInfo, access.getFunction(), preprocessing, startYear, endYear, ud, qtext, missingVolFrom, missingVolTo);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
103 results.addResult(result, problems);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
104
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
105 // // missing volume calculation
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
106 // if (access.getMissingVolFrom() != null) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
107 // /// FIRST RESULT
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
108 // final List<ResultRow> listResult1 = new ArrayList<>();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
109 // final ResultRow rowResult1 = ResultRow.create();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
110 // rowResult1.putValue(BunduResultType.bezugswst, 45.15);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
111 // rowResult1.putValue(GeneralResultType.dischargeQwithUnit, 890);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
112 // rowResult1.putValue(GeneralResultType.waterlevelLabel, "GLQ");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
113 // rowResult1.putValue(GeneralResultType.gaugeLabel, "Bonn");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
114 //
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
115 // 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
116 // rowResult1.putValue(BunduResultType.channelLowerEdge, 42.65);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
117 // rowResult1.putValue(BunduResultType.channelMinDepth, 2.5);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
118 // 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
119 // rowResult1.putValue(BunduResultType.missVolume, 2250);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
120 // rowResult1.putValue(BunduResultType.missMass, 3897);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
121 // rowResult1.putValue(BunduResultType.excavationVolume, 2475);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
122 // rowResult1.putValue(BunduResultType.excavationCosts, 999.99);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
123 // rowResult1.putValue(BunduResultType.channelWidth, 150);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
124 // rowResult1.putValue(BunduResultType.density, 1732);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
125 //
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
126 // rowResult1.putValue(GeneralResultType.location, "Spitzenlage");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
127 // listResult1.add(rowResult1);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
128 //
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
129 // final BezugswstMissVolCalculationResult1 r1 = new BezugswstMissVolCalculationResult1(
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
130 // 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
131 // results.addResult(r1, null);
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 // // SECOND RESULT
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
134 // final List<ResultRow> listResult2 = new ArrayList<>();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
135 // final ResultRow rowResult2 = ResultRow.create();
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 // rowResult2.putValue(GeneralResultType.station, 890);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
138 // final List<String> fieldValues = new ArrayList<>();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
139 // fieldValues.add("444 [m³] / 765 [t]");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
140 // 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
141 // fieldValues.add("444 [m³] / 765 [t]");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
142 // fieldValues.add("");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
143 // fieldValues.add("");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
144 // fieldValues.add("");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
145 // fieldValues.add("");
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("444 [m³] / 765 [t]");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
149 // rowResult2.putValue(BunduResultType.fields, fieldValues);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
150 // 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
151 //
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
152 // listResult2.add(rowResult2);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
153 //
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
154 // final BezugswstMissVolCalculationResult2 r2 = new BezugswstMissVolCalculationResult2(
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
155 // 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
156 // results.addResult(r2, null);
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 // // Third RESULT
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
159 // final List<ResultRow> listResult3 = new ArrayList<>();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
160 // final ResultRow rowResult3 = ResultRow.create();
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 // rowResult3.putValue(BunduResultType.stationForMiss, "650 - 651");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
163 // rowResult3.putValue(BunduResultType.missVolume, 52950);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
164 // rowResult3.putValue(BunduResultType.missMass, 91491);
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 // listResult3.add(rowResult3);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
167 //
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
168 // final BezugswstMissVolCalculationResult3 r3 = new BezugswstMissVolCalculationResult3(
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
169 // 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
170 // results.addResult(r3, null);
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 // }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
173
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
174 return new CalculationResult(results, problems);
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
175 }
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
176
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
177 /**
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
178 * Calculates a w-q-longitudinal section for a river range and Q specified in an artifact
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
179 */
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
180 private WQKms calculateWspl(final BUNDUArtifact bundu, final Calculation problems) {
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
181
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
182 final FixRealizingAccess access = new FixRealizingAccess(bundu);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
183 final FixRealizingCalculation calc = new FixRealizingCalculation(access);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
184
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
185 final CalculationResult res = calc.calculate();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
186
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
187 final FixRealizingResult fixRes = (FixRealizingResult) res.getData();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
188 final WQKms[] wqkms = (fixRes != null) ? fixRes.getWQKms() : new WQKms[0];
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 List<Problem> problems2 = res.getReport().getProblems();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
191 if (problems2 != null) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
192 for (final Problem problem : problems2) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
193 problems.addProblem(problem);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
194 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
195 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
196 if (wqkms.length >= 1)
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
197 return wqkms[0];
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
198 return null;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
199 }
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 * 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
203 */
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
204 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
205 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
206
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
207 final ResultRow row = ResultRow.create();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
208 row.putValue(GeneralResultType.station, station);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
209 row.putValue(BunduResultType.bezugswst, w);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
210 row.putValue(GeneralResultType.dischargeQwithUnit, q);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
211 row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel());
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
212 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
213 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
214 final double msh = bedHeightsFinder.getMeanBedHeight(station);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
215 row.putValue(SInfoResultType.meanBedHeight, msh);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
216 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
217 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
218 else
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
219 row.putValue(SInfoResultType.flowdepth, Double.NaN);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
220 final double channelDepth = channelFinder.getDepth(station);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
221 row.putValue(BunduResultType.channelDepth, channelDepth);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
222 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
223 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
224 else
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
225 row.putValue(BunduResultType.channelLowerEdge, Double.NaN);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
226 return row;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
227 }
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
228 }

http://dive4elements.wald.intevation.org