mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-08 03:52:18 +00:00
Merge branch 'master' into permission-vertical
This commit is contained in:
commit
f213912fec
430 files changed
+11679
-8566
No files matched your search
+18
-5
@@ -177,7 +177,8 @@ public class PolarDataServiceImpl implements ReplicablePolarService, ClearStateT
|
||||
return result;
|
||||
}
|
||||
|
||||
private SpeedWithBearingWithConfidence<Void> getClosestTwaTws(ManeuverType type, Speed speedAtManeuverStart,
|
||||
@Override
|
||||
public SpeedWithBearingWithConfidence<Void> getClosestTwaTws(ManeuverType type, Speed speedAtManeuverStart,
|
||||
double courseChangeDeg, BoatClass boatClass) {
|
||||
assert type == ManeuverType.TACK || type == ManeuverType.JIBE;
|
||||
double minDiff = Double.MAX_VALUE;
|
||||
@@ -186,8 +187,9 @@ public class PolarDataServiceImpl implements ReplicablePolarService, ClearStateT
|
||||
boatClass, speedAtManeuverStart, type == ManeuverType.TACK ? LegType.UPWIND : LegType.DOWNWIND,
|
||||
type == ManeuverType.TACK ? courseChangeDeg >= 0 ? Tack.PORT : Tack.STARBOARD
|
||||
: courseChangeDeg >= 0 ? Tack.STARBOARD : Tack.PORT)) {
|
||||
double diff = Math.abs(trueWindSpeedAndAngle.getObject().getBearing().getDegrees() * 2)
|
||||
- Math.abs(courseChangeDeg);
|
||||
double targetManeuverAngle = getManeuverAngleInDegreesFromTwa(
|
||||
trueWindSpeedAndAngle.getObject().getBearing().getDegrees(), type);
|
||||
double diff = Math.abs(targetManeuverAngle) - Math.abs(courseChangeDeg);
|
||||
if (diff < minDiff) {
|
||||
minDiff = diff;
|
||||
closestTwsTwa = trueWindSpeedAndAngle;
|
||||
@@ -235,11 +237,21 @@ public class PolarDataServiceImpl implements ReplicablePolarService, ClearStateT
|
||||
}
|
||||
SpeedWithBearingWithConfidence<Void> speed = polarDataMiner.getAverageSpeedAndCourseOverGround(boatClass,
|
||||
windSpeed, legType);
|
||||
Bearing bearing = new DegreeBearingImpl(speed.getObject().getBearing().getDegrees() * 2);
|
||||
Bearing bearing = new DegreeBearingImpl(getManeuverAngleInDegreesFromTwa(speed.getObject().getBearing().getDegrees(), maneuverType));
|
||||
BearingWithConfidence<Void> bearingWithConfidence = new BearingWithConfidenceImpl<Void>(bearing,
|
||||
speed.getConfidence(), null);
|
||||
return bearingWithConfidence;
|
||||
}
|
||||
|
||||
public double getManeuverAngleInDegreesFromTwa(double twa, ManeuverType maneuverType) {
|
||||
if (maneuverType == ManeuverType.TACK) {
|
||||
return Math.abs(twa) * 2;
|
||||
}
|
||||
if (maneuverType == ManeuverType.JIBE) {
|
||||
return (180 - Math.abs(twa)) * 2;
|
||||
}
|
||||
throw new IllegalArgumentException("ManeuverType needs to be tack or jibe.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertExistingFixes(TrackedRace trackedRace) {
|
||||
@@ -388,7 +400,8 @@ public class PolarDataServiceImpl implements ReplicablePolarService, ClearStateT
|
||||
return polarDataMiner.getSpeedRegressionPerAngleClusterProcessor().getRegressionsImpl();
|
||||
}
|
||||
|
||||
public Map<BoatClass, Long> getFixCointPerBoatClass() {
|
||||
@Override
|
||||
public Map<BoatClass, Long> getFixCountPerBoatClass() {
|
||||
return polarDataMiner.getSpeedRegressionPerAngleClusterProcessor().getFixCountPerBoatClass();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -107,8 +107,7 @@ public class AngleAndSpeedRegression implements Serializable {
|
||||
boolean angleFound;
|
||||
try {
|
||||
angle = angleRegression.getOrCreatePolynomialFunction().value(windSpeedCandidateInKnots);
|
||||
if ((tack == Tack.PORT && legType == LegType.UPWIND)
|
||||
|| (tack == Tack.STARBOARD && legType == LegType.DOWNWIND)) {
|
||||
if (tack == Tack.PORT) {
|
||||
angle = -angle;
|
||||
}
|
||||
angleFound = true;
|
||||
|
||||
+5
-5
@@ -181,7 +181,7 @@ public class ManeuverBasedWindEstimationTrackImpl extends WindTrackImpl {
|
||||
private final double maneuverAngleDeg;
|
||||
private final SpeedWithBearing speedAtManeuverStart;
|
||||
private final Bearing middleManeuverCourse;
|
||||
private final Distance maneuverLoss;
|
||||
private final Distance maneuverLossDistanceLost;
|
||||
private Pair<Double, SpeedWithBearingWithConfidence<Void>>[] likelihoodAndTWSBasedOnSpeedAndAngleCache;
|
||||
private ScalableBearingAndScalableDouble scalableMiddleManeuverCourseAndManeuverAngleDegCache;
|
||||
|
||||
@@ -195,7 +195,7 @@ public class ManeuverBasedWindEstimationTrackImpl extends WindTrackImpl {
|
||||
this.speedAtManeuverStart = maneuver.getSpeedWithBearingBefore();
|
||||
this.middleManeuverCourse = maneuver.getSpeedWithBearingBefore().getBearing()
|
||||
.middle(maneuver.getSpeedWithBearingAfter().getBearing());
|
||||
this.maneuverLoss = maneuver.getManeuverLoss();
|
||||
this.maneuverLossDistanceLost = maneuver.getManeuverLoss() == null ? null : maneuver.getManeuverLoss().getProjectedDistanceLost();
|
||||
@SuppressWarnings("unchecked")
|
||||
Pair<Double, SpeedWithBearingWithConfidence<Void>>[] myLikelihoodAndTWSBasedOnSpeedAndAngleCache = (Pair<Double, SpeedWithBearingWithConfidence<Void>>[]) new Pair<?, ?>[ManeuverType
|
||||
.values().length];
|
||||
@@ -269,8 +269,8 @@ public class ManeuverBasedWindEstimationTrackImpl extends WindTrackImpl {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Distance getManeuverLoss() {
|
||||
return maneuverLoss;
|
||||
public Distance getManeuverLossDistanceLost() {
|
||||
return maneuverLossDistanceLost;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -322,7 +322,7 @@ public class ManeuverBasedWindEstimationTrackImpl extends WindTrackImpl {
|
||||
result.append("\t");
|
||||
result.append(mc.getMiddleManeuverCourse().getDegrees());
|
||||
result.append("\t");
|
||||
result.append(mc.getManeuverLoss() == null ? 0.0 : mc.getManeuverLoss().getMeters());
|
||||
result.append(mc.getManeuverLossDistanceLost() == null ? 0.0 : mc.getManeuverLossDistanceLost().getMeters());
|
||||
result.append("\t");
|
||||
result.append(mc.getLikelihoodAndTWSBasedOnSpeedAndAngle(ManeuverType.TACK).getA());
|
||||
result.append("\t");
|
||||
|
||||
Reference in new issue
Block a user