comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/TkhCalculator.java @ 8940:82998242ba84

Preparing for additional outputs of SINFO-Tkh
author gernotbelger
date Tue, 06 Mar 2018 18:51:18 +0100
parents 9c02733a1b3c
children 5d5d482da3e9
comparison
equal deleted inserted replaced
8939:2970368ae1e3 8940:82998242ba84
138 138
139 final SoilKind kind = getSoilKind(km); 139 final SoilKind kind = getSoilKind(km);
140 140
141 final double meanBedHeight = this.bedHeightsProvider.getMeanBedHeight(km); 141 final double meanBedHeight = this.bedHeightsProvider.getMeanBedHeight(km);
142 142
143 final double flowDepth = wst - meanBedHeight;
144
143 final double discharge = getDischarge(km); 145 final double discharge = getDischarge(km);
144 if (Double.isNaN(discharge)) { 146 if (Double.isNaN(discharge)) {
145 147
146 // final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingQ", null, 148 // final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingQ", null,
147 // this.problemLabel); 149 // this.problemLabel);
148 // this.problems.addProblem(km, message); 150 // this.problems.addProblem(km, message);
149 151
150 // TODO: nochmal gemeinsam überlegen welche probleme wir loggen, an dieser stelle müsste man ggf. die station 152 // TODO: nochmal gemeinsam überlegen welche probleme wir loggen, an dieser stelle müsste man ggf. die station
151 // mitausgeben 153 // mitausgeben
152 154
153 return new Tkh(km, wst, meanBedHeight, Double.NaN, kind, Double.NaN, Double.NaN, Double.NaN); 155 return new Tkh(km, wst, meanBedHeight, flowDepth, Double.NaN, kind);
154 } 156 }
155 157
156 final double d50 = getBedMeasurement(km); 158 final double d50 = getBedMeasurement(km);
157 if (Double.isNaN(d50)) 159 if (Double.isNaN(d50))
158 return new Tkh(km, wst, meanBedHeight, discharge, kind, Double.NaN, Double.NaN, Double.NaN); 160 return new Tkh(km, wst, meanBedHeight, flowDepth, discharge, kind);
159 161
160 if (!this.flowVelocitiesFinder.findKmQValues(km, discharge)) { 162 if (!this.flowVelocitiesFinder.findKmQValues(km, discharge)) {
161 // TODO: ggf. station in Fehlermeldung? 163 // TODO: ggf. station in Fehlermeldung?
162 final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingVelocity", null, this.problemLabel); 164 final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingVelocity", null, this.problemLabel);
163 this.problems.addProblem(km, message); 165 this.problems.addProblem(km, message);
164 // FIXME: cumulate problems to one message? 166 // FIXME: cumulate problems to one message?
165 return new Tkh(km, wst, meanBedHeight, discharge, kind, Double.NaN, Double.NaN, Double.NaN); 167 return new Tkh(km, wst, meanBedHeight, flowDepth, discharge, kind);
166 } 168 }
167 169
168 final double tkh = calculateTkh(wst - meanBedHeight, this.flowVelocitiesFinder.getFindVmainFound(), d50, this.flowVelocitiesFinder.getFindTauFound()); 170 final double velocity = this.flowVelocitiesFinder.getFindVmainFound();
171 final double tau = this.flowVelocitiesFinder.getFindTauFound();
172
173 final double tkh = calculateTkh(wst - meanBedHeight, velocity, d50, tau);
169 double tkhUp; 174 double tkhUp;
170 double tkhDown; 175 double tkhDown;
171 switch (kind) { 176 switch (kind) {
172 case starr: 177 case starr:
173 tkhUp = tkh; 178 tkhUp = tkh;
179 tkhUp = tkh / 2; 184 tkhUp = tkh / 2;
180 tkhDown = -tkh / 2; 185 tkhDown = -tkh / 2;
181 break; 186 break;
182 } 187 }
183 188
184 return new Tkh(km, wst, meanBedHeight, discharge, kind, tkh, tkhUp, tkhDown); 189 final double flowDepthTkh = calculateFlowDepthTkh(tkhUp, kind, wst, meanBedHeight);
190
191 return new Tkh(km, wst, meanBedHeight, flowDepth, flowDepthTkh, discharge, kind, tkh, tkhUp, tkhDown, velocity, d50, tau);
185 } 192 }
186 193
187 /** 194 /**
188 * Calculates a transport body height 195 * Calculates a transport body height
189 * 196 *
215 if (tkh < 0.0) 222 if (tkh < 0.0)
216 return 0.0; 223 return 0.0;
217 224
218 return tkh; 225 return tkh;
219 } 226 }
227
228 private double calculateFlowDepthTkh(final double tkhValue, final SoilKind tkhKind, final double wst, final double meanBedHeight) {
229
230 if (Double.isNaN(tkhValue) || tkhKind == null)
231 return Double.NaN;
232
233 switch (tkhKind) {
234 case starr:
235 return wst - (meanBedHeight + tkhValue / 100);
236
237 case mobil:
238 default:
239 return wst - (meanBedHeight + tkhValue / 200);
240 }
241 }
220 } 242 }

http://dive4elements.wald.intevation.org