mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-29 00:46:45 +00:00
Also print the perAngle polar speed regression functions
This commit is contained in:
@@ -194,5 +194,19 @@ public interface PolarDataService {
|
||||
*/
|
||||
PolynomialFunction getAngleRegressionFunction(BoatClass boatClass, LegType legType, Tack tack) throws NotEnoughDataHasBeenAddedException;
|
||||
|
||||
/**
|
||||
* This method is not intended to be used directly apart from debugging purposes. If you intend to use the polar service please
|
||||
* use {@link #getSpeed(BoatClass, Speed, Bearing)}.
|
||||
*
|
||||
* @param boatClass
|
||||
* @param trueWindAngle
|
||||
* @return The estimating function for the true wind angle estimating boatspeed over windspeed for the
|
||||
* given boat class. All values in kn.
|
||||
* @throws NotEnoughDataHasBeenAddedException
|
||||
*/
|
||||
PolynomialFunction getSpeedRegressionFunction(BoatClass boatClass, double trueWindAngle) throws NotEnoughDataHasBeenAddedException;
|
||||
|
||||
void raceFinishedLoading(TrackedRace race);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -146,9 +146,16 @@ public class PolarDataServiceImpl implements PolarDataService {
|
||||
throws NotEnoughDataHasBeenAddedException {
|
||||
return polarDataMiner.getAngleRegressionFunction(boatClass, legType, tack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PolynomialFunction getSpeedRegressionFunction(BoatClass boatClass, double trueWindAngle)
|
||||
throws NotEnoughDataHasBeenAddedException {
|
||||
return polarDataMiner.getSpeedRegressionFunction(boatClass, trueWindAngle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void raceFinishedLoading(TrackedRace race) {
|
||||
polarDataMiner.raceFinishedTracking(race);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -410,6 +410,11 @@ public class PolarDataMiner {
|
||||
throws NotEnoughDataHasBeenAddedException {
|
||||
return cubicRegressionPerCourseProcessor.getAngleRegressionFunction(boatClass, legType, tack);
|
||||
}
|
||||
|
||||
public PolynomialFunction getSpeedRegressionFunction(BoatClass boatClass, double trueWindAngle)
|
||||
throws NotEnoughDataHasBeenAddedException {
|
||||
return speedRegressionPerAngleClusterProcessor.getSpeedRegressionFunction(boatClass, trueWindAngle);
|
||||
}
|
||||
|
||||
public void raceFinishedTracking(TrackedRace race) {
|
||||
Set<GPSFixMovingWithOriginInfo> fixes = null;
|
||||
|
||||
+15
-2
@@ -4,6 +4,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
|
||||
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.SpeedWithConfidence;
|
||||
import com.sap.sailing.domain.base.impl.SpeedWithConfidenceImpl;
|
||||
@@ -102,8 +104,19 @@ private static final Logger logger = Logger.getLogger(CubicRegressionPerCoursePr
|
||||
logger.severe("Polar Data Mining Pipe failed.");
|
||||
throw new RuntimeException("Polar Data Miner failed.", failure);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public PolynomialFunction getSpeedRegressionFunction(BoatClass boatClass, double trueWindAngle)
|
||||
throws NotEnoughDataHasBeenAddedException {
|
||||
GroupKey key = createGroupKey(boatClass, new DegreeBearingImpl(trueWindAngle));
|
||||
PolynomialFunction polynomialFunction;
|
||||
if (regressions.containsKey(key)) {
|
||||
polynomialFunction = regressions.get(key).getOrCreatePolynomialFunction();
|
||||
} else {
|
||||
throw new NotEnoughDataHasBeenAddedException();
|
||||
}
|
||||
return polynomialFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<GroupedDataEntry<GPSFixMovingWithPolarContext>> getInputType() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
+8
@@ -96,6 +96,14 @@ public class PolarResource extends AbstractSailingServerResource {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (double trueWindAngle = -177.5; trueWindAngle < 180; trueWindAngle = trueWindAngle + 5) {
|
||||
try {
|
||||
PolynomialFunction speedForTWAFunction = polarDataService.getSpeedRegressionFunction(boatClass, trueWindAngle);
|
||||
stringBuilder.append("Speed for TWA: " + boatClass + " " + trueWindAngle + ": " + speedForTWAFunction.toString() + "\n");
|
||||
} catch (NotEnoughDataHasBeenAddedException e) {
|
||||
stringBuilder.append("No data for " + boatClass + " " + trueWindAngle + "\n");
|
||||
}
|
||||
}
|
||||
stringBuilder.append("\n\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user