Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9528:55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
author | mschaefer |
---|---|
date | Tue, 02 Oct 2018 16:39:51 +0200 |
parents | 3f230fe8eb19 |
children | 3fa8551c3d1b |
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; | |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
14 import java.util.Calendar; |
9313 | 15 import java.util.List; |
16 | |
17 import org.dive4elements.artifacts.CallContext; | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
18 import org.dive4elements.river.artifacts.access.FixRealizingAccess; |
9313 | 19 import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; |
9318
7b2b086e45f0
collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents:
9313
diff
changeset
|
20 import org.dive4elements.river.artifacts.bundu.BunduResultType; |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
21 import org.dive4elements.river.artifacts.common.AbstractResultType; |
9313 | 22 import org.dive4elements.river.artifacts.common.GeneralResultType; |
23 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
|
24 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
|
25 import org.dive4elements.river.artifacts.model.Calculation.Problem; |
9313 | 26 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
|
27 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
|
28 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
|
29 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; |
9499 | 30 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider; |
9313 | 31 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
|
32 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
|
33 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
|
34 import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper; |
9313 | 35 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; |
36 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
9323 | 37 import org.dive4elements.river.artifacts.sinfo.util.WstInfo; |
9528
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
38 import org.dive4elements.river.artifacts.states.WaterlevelData; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
39 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
|
40 import org.dive4elements.river.model.BedHeightValueType; |
9313 | 41 import org.dive4elements.river.model.River; |
9451 | 42 import org.dive4elements.river.utils.DoubleUtil; |
9313 | 43 |
44 class BezugswstCalculation { | |
45 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
46 // private static Logger log = Logger.getLogger(BezugswstCalculation.class); |
9313 | 47 |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
48 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
49 * Additional depth (m) to compute the excavation volume |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
50 */ |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
51 private final static double EXCAVATION_DEPTH = 0.2; // REMARK Sollte von außen einstellbar sein |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
52 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
53 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
54 * Excavation costs (euro) per cubic meter |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
55 */ |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
56 private final static double EXPENSE_PER_CBM = 12.0; // REMARK Sollte von außen einstellbar sein |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
57 |
9313 | 58 private final CallContext context; |
59 | |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
60 private final List<ResultRow> rows; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
61 |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
62 private Double missKmFrom; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
63 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
64 private Double missKmTo; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
65 |
9313 | 66 public BezugswstCalculation(final CallContext context) { |
67 this.context = context; | |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
68 this.rows = new ArrayList<>(); |
9313 | 69 } |
70 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
71 /** |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
72 * 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
|
73 */ |
9313 | 74 public CalculationResult calculate(final BUNDUArtifact bunduartifact) { |
75 | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
76 // Get input data |
9313 | 77 final String user = CalculationUtils.findArtifactUser(this.context, bunduartifact); |
78 final BunduAccess access = new BunduAccess(bunduartifact); | |
79 final River river = access.getRiver(); | |
80 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
|
81 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
|
82 final boolean preprocessing = access.getPreprocessing(); |
9323 | 83 final int startYear = access.getStartYear(); |
84 final int endYear = access.getBezugsJahr(); | |
85 final Integer ud = access.getUd(); | |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
86 this.missKmFrom = access.getMissingVolFrom(); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
87 this.missKmTo = access.getMissingVolTo(); |
9330
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
88 |
9495
bb278c927b66
Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents:
9480
diff
changeset
|
89 final BezugswstCalculationResults results = new BezugswstCalculationResults(calcModeLabel, user, riverInfo, access.getRange(), |
bb278c927b66
Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents:
9480
diff
changeset
|
90 access.isCalculateMissingVolume()); |
9330
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
91 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
92 final Calculation problems = new Calculation(); |
9331 | 93 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
94 // Calculate the wspl for the selected river range as in fixa awspl |
9465
be9bd06a1e3f
bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents:
9451
diff
changeset
|
95 bunduartifact.addStringData("wq_isq", "true"); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
96 final WinfoArtifactWrapper winfo = new WinfoArtifactWrapper(bunduartifact); |
9528
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
97 final RiverInfoProvider riverInfoProvider = RiverInfoProvider.forRange(this.context, river, access.getRange()); |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
98 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
|
99 if (fixResult == null) |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
100 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
|
101 |
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
102 final WQKms wqkms = fixResult.getWQKms()[0]; |
9528
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
103 // We have no wst year as the wst is created by a calculation; we do not need it though |
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
104 final int wspYear = -1; |
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
105 // Remark: showAllGauges true for Fixierungsanalyse, false for WInfo, so true here as well |
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
106 final boolean showAllGauges = true; |
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
107 final WaterlevelData waterlevel = new WaterlevelData(wqkms, wspYear, showAllGauges, true); |
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
108 final RiverInfoProvider riverInfoProvider2 = riverInfoProvider.forWaterlevel(waterlevel); |
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
109 final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider2.getReferenceGauge(), true); |
9331 | 110 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
111 // Fetch the bed heights of the selected sounding |
9480
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
112 final Integer bedHeightId = access.getBedHeightID(); |
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
113 final BedHeightsFinder bedHeightsFinder = (bedHeightId != null) ? BedHeightsFinder.forId(problems, bedHeightId, access.getRange()) |
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
114 : BedHeightsFinder.NullFinder(); |
9332 | 115 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
116 // Fetch the river channel data |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
117 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
|
118 if (channelFinder == null) |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
119 return new CalculationResult(results, problems); |
9332 | 120 |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
121 // Compute the result rows |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
122 for (int i = 0; i <= wqkms.size() - 1; i++) { |
9528
55c187a0a31e
Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents:
9505
diff
changeset
|
123 this.rows.add(createRow(wqkms.getKm(i), wqkms.getW(i), wqkms.getQ(i), bedHeightsFinder, channelFinder, riverInfoProvider2, wstInfo)); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
124 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
125 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
126 // Compute the missing volumes |
9495
bb278c927b66
Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents:
9480
diff
changeset
|
127 if (access.isCalculateMissingVolume()) { |
9480
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
128 if ((bedHeightsFinder == null) || bedHeightsFinder.isNull()) |
9465
be9bd06a1e3f
bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents:
9451
diff
changeset
|
129 return new CalculationResult(results, problems); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
130 computeMissingVolumes(problems); |
9451 | 131 final BedQualityCalculator bqCalculator = computeDensities(problems, bunduartifact, access, river); |
132 computeMissingMasses(problems, bqCalculator); | |
9330
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
133 } |
0a0937f33bb5
bundu.bezugswst first result for missing volume added
gernotbelger
parents:
9323
diff
changeset
|
134 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
135 // 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
|
136 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
|
137 final String qtext = descBuilder.getMetadataQ(); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
138 final BezugswstMainCalculationResult result = new BezugswstMainCalculationResult("bundu-bzws", this.rows, bedHeightsFinder.getInfo(), wstInfo, |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
139 access.getFunction(), preprocessing, startYear, endYear, ud, qtext, wqkms, this.missKmFrom, this.missKmTo); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
140 results.addResult(result, problems); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
141 |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
142 // Create the missing volume results |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
143 if (access.getMissingVolFrom() != null) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
144 final String title1 = Resources.getMsg(this.context.getMeta(), "bundu.export.csv.title.bezugswst.result1"); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
145 final BezugswstMissVolCalculationResult1 r1 = new BezugswstMissVolCalculationResult1(title1, this.rows); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
146 results.addResult(r1, null); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
147 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
148 final String title2 = Resources.getMsg(this.context.getMeta(), "bundu.export.csv.title.bezugswst.result2"); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
149 final List<ResultRow> rows2 = copyMissRows(); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
150 final BezugswstMissVolCalculationResult2 r2 = new BezugswstMissVolCalculationResult2(title2, rows2); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
151 results.addResult(r2, null); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
152 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
153 final String title3 = Resources.getMsg(this.context.getMeta(), "bundu.export.csv.title.bezugswst.result3"); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
154 final List<ResultRow> totalRows = new ArrayList<>(); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
155 totalRows.add(createTotalsRow(problems)); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
156 final BezugswstMissVolCalculationResult3 r3 = new BezugswstMissVolCalculationResult3(title3, totalRows); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
157 results.addResult(r3, null); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
158 } |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
159 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
160 return new CalculationResult(results, problems); |
9313 | 161 } |
162 | |
163 /** | |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
164 * Calculates a w-q-longitudinal section for a river range and Q specified in an artifact |
9313 | 165 */ |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
166 private FixRealizingResult calculateWspl(final BUNDUArtifact bundu, final Calculation problems) { |
9313 | 167 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
168 final FixRealizingAccess access = new FixRealizingAccess(bundu); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
169 final FixRealizingCalculation calc = new FixRealizingCalculation(access); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
170 |
9479
2b83d3a96703
i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents:
9465
diff
changeset
|
171 final CalculationResult res = calc.calculate(this.context.getMeta()); |
9432
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 FixRealizingResult fixRes = (FixRealizingResult) res.getData(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
174 |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
175 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
|
176 if (problems2 != null) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
177 for (final Problem problem : problems2) { |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
178 problems.addProblem(problem); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
179 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
180 } |
9438
d2f5375ede26
Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents:
9437
diff
changeset
|
181 return fixRes; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
182 } |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
183 |
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 * 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
|
186 */ |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
187 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
|
188 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
|
189 |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
190 // Set W and Q |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
191 final ResultRow row = ResultRow.create(); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
192 row.putValue(GeneralResultType.station, station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
193 row.putValue(BunduResultType.bezugswst, w); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
194 row.putValue(GeneralResultType.dischargeQwithUnit, q); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
195 row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel()); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
196 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
|
197 row.putValue(GeneralResultType.location, riverInfoProv.getLocation(station)); |
9480
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
198 if (bedHeightsFinder.getInfo() != null) |
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
199 row.putValue(BunduResultType.sounding, bedHeightsFinder.getInfo().getDescription()); |
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
200 else |
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
201 row.putValue(BunduResultType.sounding, ""); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
202 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
203 // Set bed and channel bottom height |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
204 final double msh = bedHeightsFinder.getMeanBedHeight(station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
205 row.putValue(SInfoResultType.meanBedHeight, msh); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
206 if (!Double.isNaN(w) && !Double.isNaN(msh)) |
9505
3f230fe8eb19
Bezugspegel-assignment changed for coinciding gauge and calculation range (Meilenstein-2 2.2.4)
mschaefer
parents:
9499
diff
changeset
|
207 row.putValue(SInfoResultType.flowdepth, w - msh); |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
208 else |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
209 row.putValue(SInfoResultType.flowdepth, Double.NaN); |
9465
be9bd06a1e3f
bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents:
9451
diff
changeset
|
210 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
211 final double channelDepth = channelFinder.getDepth(station); |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
212 row.putValue(BunduResultType.channelDepth, channelDepth); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
213 double channelHeight; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
214 if (!Double.isNaN(w) && !Double.isNaN(channelDepth)) |
9505
3f230fe8eb19
Bezugspegel-assignment changed for coinciding gauge and calculation range (Meilenstein-2 2.2.4)
mschaefer
parents:
9499
diff
changeset
|
215 channelHeight = w - channelDepth; |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
216 else |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
217 channelHeight = Double.NaN; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
218 row.putValue(BunduResultType.channelLowerEdge, channelHeight); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
219 final double channelWidth = channelFinder.getWidth(station); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
220 row.putValue(BunduResultType.channelWidth, channelWidth); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
221 if (!Double.isNaN(channelHeight)) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
222 if (msh > channelHeight + 0.001) |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
223 row.putValue(BunduResultType.missDepthMeanBed, msh - channelHeight); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
224 else |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
225 row.putValue(BunduResultType.missDepthMeanBed, 0.0); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
226 } |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
227 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
228 // Set field heights and missing heights |
9444
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> 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
|
230 final List<Double> fieldDepths = new ArrayList<>(); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
231 final List<Double> fieldMissDepths = new ArrayList<>(); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
232 final List<Double> fieldMissWidths = new ArrayList<>(); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
233 final List<Double> fieldNulls = new ArrayList<>(); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
234 int missFieldCnt = 0; |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
235 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
|
236 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
|
237 fieldHeights.add(Double.valueOf(h)); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
238 fieldDepths.add(Double.valueOf(w - h)); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
239 if (h > channelHeight + 0.001) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
240 missFieldCnt++; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
241 fieldMissDepths.add(Double.valueOf(h - channelHeight)); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
242 fieldMissWidths.add(Double.valueOf(channelWidth / BedHeightValueType.FIELD_LAST_INDEX)); |
9448 | 243 } else { |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
244 fieldMissDepths.add(Double.valueOf(0.0)); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
245 fieldMissWidths.add(Double.valueOf(0.0)); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
246 } |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
247 fieldNulls.add(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
|
248 } |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
249 if (isKmInMissingVolumeRange(station)) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
250 row.putValue(BunduResultType.missDepthFields, fieldMissDepths); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
251 row.putValue(BunduResultType.missWidthFields, fieldMissWidths); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
252 row.putValue(BunduResultType.hasMissingDepth, (missFieldCnt >= 1)); |
9465
be9bd06a1e3f
bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents:
9451
diff
changeset
|
253 } else { |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
254 row.putValue(BunduResultType.missDepthFields, fieldNulls); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
255 row.putValue(BunduResultType.missWidthFields, fieldNulls); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
256 row.putValue(BunduResultType.hasMissingDepth, null); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
257 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
258 row.putValue(BunduResultType.missVolumeFields, fieldNulls); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
259 row.putValue(BunduResultType.missMassFields, fieldNulls); |
9444
ecadc9ed0ba0
Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents:
9438
diff
changeset
|
260 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
|
261 row.putValue(BunduResultType.depthFields, fieldDepths); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
262 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
263 // Preset the missing volume fields with NaN |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
264 row.putValue(BunduResultType.excavationCosts, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
265 row.putValue(BunduResultType.excavationVolume, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
266 row.putValue(BunduResultType.missVolumeMeanBed, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
267 row.putValue(BunduResultType.missMassMeanBed, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
268 row.putValue(BunduResultType.missVolumeTotal, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
269 row.putValue(BunduResultType.missMassTotal, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
270 row.putValue(BunduResultType.density, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
271 row.putValue(BunduResultType.missStationRangeFrom, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
272 row.putValue(BunduResultType.missStationRangeTo, Double.NaN); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
273 |
9432
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
274 return row; |
d194c5b24bf8
Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents:
9337
diff
changeset
|
275 } |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
276 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
277 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
278 * Computes the missing volumes in a km range |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
279 */ |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
280 private void computeMissingVolumes(final Calculation problems) { |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
281 // Search start km |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
282 int first = -1; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
283 for (int j = 0; j <= this.rows.size() - 1; j++) { |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
284 if (isKmInMissingVolumeRange(this.rows.get(j).getDoubleValue(GeneralResultType.station))) { |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
285 first = j; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
286 break; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
287 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
288 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
289 if (first < 0) |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
290 return; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
291 int last = this.rows.size() - 1; |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
292 for (int i = first; i <= this.rows.size() - 1; i++) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
293 if (!isKmInMissingVolumeRange(this.rows.get(i).getDoubleValue(GeneralResultType.station))) |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
294 break; |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
295 if (this.rows.get(i).getDoubleValue(GeneralResultType.station) > this.missKmTo.doubleValue() - 0.0001) |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
296 last = i; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
297 final List<Double> areas = new ArrayList<>(); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
298 final List<Double> volumes = new ArrayList<>(); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
299 double vTotal = 0.0; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
300 double vExcav = 0.0; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
301 for (int j = BedHeightValueType.FIELD_FIRST_INDEX; j <= BedHeightValueType.FIELD_LAST_INDEX; j++) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
302 if (getFieldValue(i, BunduResultType.missDepthFields, j) > 0.0001) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
303 computeMissingVolume(volumes, areas, i, first, last, j); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
304 vTotal += volumes.get(j - 1); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
305 vExcav += volumes.get(j - 1) + areas.get(j - 1) * EXCAVATION_DEPTH; |
9448 | 306 } else { |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
307 volumes.add(Double.valueOf(0.0)); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
308 areas.add(Double.valueOf(0.0)); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
309 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
310 } |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
311 final double[] meanBedVolumeArea = computeMeanBedMissingAreaAndVolume(i, first, last); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
312 this.rows.get(i).putValue(BunduResultType.missVolumeMeanBed, meanBedVolumeArea[0]); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
313 this.rows.get(i).putValue(BunduResultType.missAreaMeanBed, meanBedVolumeArea[1]); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
314 this.rows.get(i).putValue(BunduResultType.missVolumeFields, volumes); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
315 this.rows.get(i).putValue(BunduResultType.missAreaFields, areas); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
316 this.rows.get(i).putValue(BunduResultType.missVolumeTotal, vTotal); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
317 this.rows.get(i).putValue(BunduResultType.excavationVolume, vExcav); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
318 this.rows.get(i).putValue(BunduResultType.excavationCosts, vExcav * EXPENSE_PER_CBM); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
319 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
320 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
321 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
322 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
323 * Computes the missing volume of a field of a km row |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
324 */ |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
325 private void computeMissingVolume(final List<Double> volumes, final List<Double> areas, final int current, final int first, final int last, |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
326 final int field) { |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
327 |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
328 final double areaCurr = missingArea(current, first, last, field); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
329 final double areaPrev = missingArea(current - 1, first, last, field); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
330 final double areaNext = missingArea(current + 1, first, last, field); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
331 final double kmCurr = missingKm(current); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
332 final double kmPrev = missingKm(current - 1); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
333 final double kmNext = missingKm(current + 1); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
334 final double area1 = Double.isNaN(kmPrev) ? 0.0 : 0.5 * (areaCurr + areaPrev); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
335 final double area2 = Double.isNaN(kmNext) ? 0.0 : 0.5 * (areaCurr + areaNext); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
336 final double volume = Double.valueOf((Math.abs(kmCurr - kmPrev) * 500 * area1) + (Math.abs(kmNext - kmCurr) * 500 * area2)); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
337 volumes.add(volume); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
338 if (!Double.isNaN(volume)) |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
339 areas.add(Double.valueOf(area1 + area2)); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
340 else |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
341 areas.add(Double.NaN); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
342 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
343 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
344 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
345 * Gets the missing area of a field and a row if in range, otherwise 0.0 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
346 */ |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
347 private double missingArea(final int rowIndex, final int first, final int last, final int fieldIndex) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
348 if ((first <= rowIndex) && (rowIndex <= last)) |
9448 | 349 return getFieldValue(rowIndex, BunduResultType.missDepthFields, fieldIndex) * getFieldValue(rowIndex, BunduResultType.missWidthFields, fieldIndex); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
350 else |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
351 return 0.0; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
352 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
353 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
354 /** |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
355 * Computes the missing area and volume of the mean bed height of a km row |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
356 */ |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
357 private double[] computeMeanBedMissingAreaAndVolume(final int current, final int first, final int last) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
358 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
359 final double areaCurr = meanBedMissingArea(current, first, last); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
360 final double areaPrev = meanBedMissingArea(current - 1, first, last); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
361 final double areaNext = meanBedMissingArea(current + 1, first, last); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
362 final double kmCurr = missingKm(current); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
363 final double kmPrev = missingKm(current - 1); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
364 final double kmNext = missingKm(current + 1); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
365 final double area1 = Double.isNaN(kmPrev) ? 0.0 : 0.5 * (areaCurr + areaPrev); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
366 final double area2 = Double.isNaN(kmNext) ? 0.0 : 0.5 * (areaCurr + areaNext); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
367 final double volume = Double.valueOf((Math.abs(kmCurr - kmPrev) * 500 * area1) + (Math.abs(kmNext - kmCurr) * 500 * area2)); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
368 final double area = Double.isNaN(volume) ? Double.NaN : Double.valueOf(area1 + area2); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
369 return new double[] { volume, area }; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
370 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
371 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
372 /** |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
373 * Gets the missing area of the mean bed height and a row if in range, otherwise 0.0 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
374 */ |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
375 private double meanBedMissingArea(final int rowIndex, final int first, final int last) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
376 if ((first <= rowIndex) && (rowIndex <= last)) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
377 final double dh = this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelDepth) |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
378 - this.rows.get(rowIndex).getDoubleValue(SInfoResultType.flowdepth); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
379 if (dh > 0.0) |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
380 return dh * this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelWidth); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
381 return 0.0; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
382 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
383 return 0.0; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
384 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
385 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
386 /** |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
387 * Gets the km of a row if within range, otherwise NaN |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
388 */ |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
389 private double missingKm(final int rowIndex) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
390 if ((0 <= rowIndex) && (rowIndex <= this.rows.size() - 1)) |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
391 return this.rows.get(rowIndex).getDoubleValue(GeneralResultType.station); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
392 return Double.NaN; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
393 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
394 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
395 /** |
9451 | 396 * Create a density calculator and compute the densities of the missing volume km range and time period according to the |
397 * reference year | |
398 */ | |
399 private BedQualityCalculator computeDensities(final Calculation problems, final BUNDUArtifact bunduartifact, final BunduAccess access, final River river) { | |
400 final BedQualityCalculator bqCalculator = new BedQualityCalculator(this.context, bunduartifact); | |
401 // REMARK 10km tolerance at start and end to enable interpolation there | |
402 final double[] kms = DoubleUtil.explode(access.getMissingVolFrom().doubleValue() - 10.0, access.getMissingVolTo().doubleValue() + 10.0, | |
403 access.getStep().doubleValue() / 1000); | |
404 final Calendar endDay = Calendar.getInstance(); | |
405 endDay.set(access.getBezugsJahr().intValue(), 11, 31); | |
406 final Calendar startDay = Calendar.getInstance(); | |
407 // TODO Spezialregelung für den Rhein (bis 1999, 2000 bis 2009, ab 2010) | |
408 startDay.set(endDay.get(Calendar.YEAR) - 20, 0, 1); | |
409 bqCalculator.execute(problems, river, kms, startDay.getTime(), endDay.getTime()); | |
410 return bqCalculator; | |
411 } | |
412 | |
413 /** | |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
414 * Computes the missing masses |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
415 */ |
9451 | 416 private void computeMissingMasses(final Calculation problems, final BedQualityCalculator densityFinder) { |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
417 for (final ResultRow row : this.rows) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
418 @SuppressWarnings("unchecked") |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
419 final List<Double> volumes = (List<Double>) row.getValue(BunduResultType.missVolumeFields); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
420 if ((volumes == null) || Double.isNaN(volumes.get(0))) |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
421 continue; |
9451 | 422 final double density = getDensity(row.getDoubleValue(GeneralResultType.station), densityFinder); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
423 final List<Double> masses = new ArrayList<>(); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
424 double kmTotal = 0.0; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
425 for (int j = BedHeightValueType.FIELD_FIRST_INDEX; j <= BedHeightValueType.FIELD_LAST_INDEX; j++) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
426 final double m = volumes.get(j - 1) * density; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
427 masses.add(m); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
428 if (!Double.isNaN(m)) |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
429 kmTotal += m; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
430 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
431 row.putValue(BunduResultType.density, density); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
432 row.putValue(BunduResultType.missMassFields, masses); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
433 row.putValue(BunduResultType.missMassTotal, kmTotal); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
434 row.putValue(BunduResultType.missMassMeanBed, row.getDoubleValue(BunduResultType.missVolumeMeanBed) * density); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
435 } |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
436 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
437 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
438 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
439 * Gets a value of one of the field list types of a row |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
440 * |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
441 * @param rowIndex |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
442 * @param type |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
443 * @param fieldIndex |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
444 * 1-based field index |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
445 */ |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
446 private double getFieldValue(final int rowIndex, final AbstractResultType type, final int fieldIndex) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
447 @SuppressWarnings("unchecked") |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
448 final List<Double> values = (List<Double>) this.rows.get(rowIndex).getValue(type); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
449 return values.get(fieldIndex - 1); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
450 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
451 |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
452 /** |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
453 * Computes the volume and mass total of all rows with missing volumes |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
454 */ |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
455 private ResultRow createTotalsRow(final Calculation problems) { |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
456 // Search start km |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
457 double vTotal = 0.0; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
458 double mTotal = 0.0; |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
459 double eTotal = 0.0; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
460 double cTotal = 0.0; |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
461 for (final ResultRow row : this.rows) { |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
462 final double volume = row.getDoubleValue(BunduResultType.missVolumeTotal); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
463 final double mass = row.getDoubleValue(BunduResultType.missMassTotal); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
464 final double excavation = row.getDoubleValue(BunduResultType.excavationVolume); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
465 final double costs = row.getDoubleValue(BunduResultType.excavationCosts); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
466 if (!Double.isNaN(volume) && !Double.isNaN(mass)) { |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
467 vTotal += volume; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
468 mTotal += mass; |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
469 eTotal += excavation; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
470 cTotal += costs; |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
471 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
472 } |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
473 final ResultRow sumRow = ResultRow.create(); |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
474 sumRow.putValue(BunduResultType.missStationRangeFrom, Double.valueOf(this.missKmFrom)); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
475 sumRow.putValue(BunduResultType.missStationRangeTo, Double.valueOf(this.missKmTo)); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
476 sumRow.putValue(BunduResultType.missVolumeTotal, vTotal); |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
477 sumRow.putValue(BunduResultType.missMassTotal, mTotal); |
9480
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
478 sumRow.putValue(BunduResultType.excavationVolumeTotal, eTotal); |
7228bd10a8cc
Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents:
9479
diff
changeset
|
479 sumRow.putValue(BunduResultType.excavationCostsTotal, cTotal); |
9446
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
480 return sumRow; |
e60584f2a531
Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents:
9444
diff
changeset
|
481 } |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
482 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
483 /** |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
484 * Copies the rows of the missing volume calculation range into a new list |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
485 */ |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
486 private List<ResultRow> copyMissRows() { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
487 final List<ResultRow> missRows = new ArrayList<>(); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
488 for (final ResultRow row : this.rows) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
489 final double km = row.getDoubleValue(GeneralResultType.station); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
490 if (isKmInMissingVolumeRange(km)) |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
491 missRows.add(row); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
492 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
493 return missRows; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
494 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
495 |
9451 | 496 /** |
497 * Gets the density of a km from the densities calculation | |
498 */ | |
499 private double getDensity(final double km, final BedQualityCalculator densityFinder) { | |
500 return densityFinder.getDensity(km); | |
9450
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
501 } |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
502 |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
503 /** |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
504 * Checks whether a km lies in the missing volume calculation range |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
505 */ |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
506 private boolean isKmInMissingVolumeRange(final double km) { |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
507 if ((this.missKmFrom == null) || (this.missKmTo == null)) |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
508 return false; |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
509 return (this.missKmFrom.doubleValue() - 0.0001 < km) && (km < this.missKmTo.doubleValue() + 0.0001); |
7e1fb8d0cb0d
Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents:
9448
diff
changeset
|
510 } |
9313 | 511 } |