Refinement for Ascent / Descent accumulation

This commit is contained in:
sonora 2017-10-26 18:53:12 +02:00
parent 8b52111ba5
commit b33c87bf03

View file

@ -360,7 +360,7 @@ public class GPXUtilities {
channelBase = 99999;
channelTop = channelBase;
channelBottom = channelBase;
channelThres = channelThresMin;
//channelThres = channelThresMin;
float segmentDistance = 0f;
metricEnd += s.metricEnd;
@ -424,48 +424,69 @@ public class GPXUtilities {
hasSpeedInTrack = true;
}
// Trend channel analysis for elevation gain/loss, Hardy 2015-09-22:
// - Detect consecutive trend channels: Only net elevation changes per each trend channel (i.e. between turnarounds) are used to accumulate the Ascent/Descent values.
// - Trend turnaround detection: Ignore oscillations of amplitude < channelThresMin, this sests the relevance threshold, and masks what is considered as noise
// - REMOVED for now: To supress marginal measurements, relax from channelThresMin to channelThres based on the maximum VDOP of any point which contributed to the current trend. Good assumption is VDOP=2*HSOP (accounts for invisibility of lower hemisphere satellites).
// - TODO: Perform the channel evaluation with Low Pass Filter (LPF) smoothed ele data instead of with the raw ele data
if (!Double.isNaN(point.ele)) {
// Trend channel analysis for elevation gain/loss, Hardy 2015-09-22, LPF filtering added 2017-10-26:
// - Detect the consecutive elevation trend channels: Only use the net elevation changes of each trend channel (i.e. between the turnarounds) to accumulate the Ascent/Descent values.
// - Perform the channel evaluation on Low Pass Filter (LPF) smoothed ele data instead of on the raw ele data
// Parameters:
// - channelMinThres (in meters): defines the channel turnaround detection, i.e. oscillations smaller than this are ignored as irrelevant or noise.
// - smoothWindow (number of points): is the LPF window
// REMOVED, as no relevant examples found: To suppress unreliable measurement points, relax the turnaround detection from the constant channelThresMin to channelThres which is based on the maximum VDOP of any point which contributed to the current trend. (Good assumption is VDOP=2*HDOP, which accounts for invisibility of lower hemisphere satellites.)
// LPF smooting of ele data, usually smooth over odd number of values like 5
final int smoothWindow = 5;
double eleSmoothed = Double.NaN;
int j2 = 0;
for (int j1 = - smoothWindow + 1; j1 <= 0; j1++) {
if ((j + j1 >= 0) && !Double.isNaN(s.get(j + j1).ele)) {
j2++;
if (!Double.isNaN(eleSmoothed)) {
eleSmoothed = eleSmoothed + s.get(j + j1).ele;
} else {
eleSmoothed = s.get(j + j1).ele;
}
}
}
if (!Double.isNaN(eleSmoothed)) {
eleSmoothed = eleSmoothed / j2;
}
if (!Double.isNaN(eleSmoothed)) {
// Init channel
if (channelBase == 99999) {
channelBase = point.ele;
channelBase = eleSmoothed;
channelTop = channelBase;
channelBottom = channelBase;
channelThres = channelThresMin;
//channelThres = channelThresMin;
}
// Channel maintenance
if (point.ele > channelTop) {
channelTop = point.ele;
if (eleSmoothed > channelTop) {
channelTop = eleSmoothed;
//if (!Double.isNaN(point.hdop)) {
// channelThres = Math.max(channelThres, 2.0 * point.hdop); //Use empirical 2*getAccuracy(vertical), this better serves very flat tracks or high dop tracks
// channelThres = Math.max(channelThres, 2.0 * point.hdop);
//}
} else if (point.ele < channelBottom) {
channelBottom = point.ele;
} else if (eleSmoothed < channelBottom) {
channelBottom = eleSmoothed;
//if (!Double.isNaN(point.hdop)) {
// channelThres = Math.max(channelThres, 2.0 * point.hdop);
//}
}
// Turnaround (breakout) detection
if ((point.ele <= (channelTop - channelThres)) && (climb == true)) {
if ((eleSmoothed <= (channelTop - channelThres)) && (climb == true)) {
if ((channelTop - channelBase) >= channelThres) {
diffElevationUp += channelTop - channelBase;
}
channelBase = channelTop;
channelBottom = point.ele;
channelBottom = eleSmoothed;
climb = false;
channelThres = channelThresMin;
} else if ((point.ele >= (channelBottom + channelThres)) && (climb == false)) {
//channelThres = channelThresMin;
} else if ((eleSmoothed >= (channelBottom + channelThres)) && (climb == false)) {
if ((channelBase - channelBottom) >= channelThres) {
diffElevationDown += channelBase - channelBottom;
}
channelBase = channelBottom;
channelTop = point.ele;
channelTop = eleSmoothed;
climb = true;
channelThres = channelThresMin;
//channelThres = channelThresMin;
}
// End detection without breakout
if (j == (numberOfPoints - 1)) {