mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
fix check for sparse-simulation-data in polar-diagram-gps;
This commit is contained in:
1 parent
109f948388
commit
b59811705b
2 files changed
+12
-9
No files matched your search
+5
-5
@@ -395,13 +395,13 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
polarDiagram = null;
|
||||
// TODO: raise a UI message, to inform user about missing polar data resulting in unability to simulate
|
||||
}
|
||||
double simuStepSeconds = startPosition.getDistance(endPosition).getNauticalMiles()
|
||||
/ ((PolarDiagramGPS) polarDiagram).getAvgSpeed() * 3600 / 100;
|
||||
Duration simuStep = new MillisecondsDurationImpl(Math.round(simuStepSeconds) * 1000);
|
||||
SimulationParameters simulationPars = new SimulationParametersImpl(course, startLine, polarDiagram, windField,
|
||||
simuStep, SailingSimulatorConstants.ModeEvent, true, true, legType);
|
||||
Map<PathType, Path> paths = null;
|
||||
if (polarDiagram != null) {
|
||||
double simuStepSeconds = startPosition.getDistance(endPosition).getNauticalMiles()
|
||||
/ ((PolarDiagramGPS) polarDiagram).getAvgSpeed() * 3600 / 100;
|
||||
Duration simuStep = new MillisecondsDurationImpl(Math.round(simuStepSeconds) * 1000);
|
||||
SimulationParameters simulationPars = new SimulationParametersImpl(course, startLine, polarDiagram,
|
||||
windField, simuStep, SailingSimulatorConstants.ModeEvent, true, true, legType);
|
||||
paths = getAllPathsEvenTimed(simulationPars, timeStep.asMillis());
|
||||
}
|
||||
// prepare simulator-results
|
||||
|
||||
+7
-4
@@ -44,7 +44,10 @@ public class PolarDiagramGPS extends PolarDiagramBase {
|
||||
windSpeeds.add(new KnotSpeedImpl(12.0));
|
||||
windSpeeds.add(new KnotSpeedImpl(14.0));
|
||||
windSpeeds.add(new KnotSpeedImpl(16.0));
|
||||
windSpeeds.add(new KnotSpeedImpl(18.0));
|
||||
windSpeeds.add(new KnotSpeedImpl(20.0));
|
||||
windSpeeds.add(new KnotSpeedImpl(22.0));
|
||||
windSpeeds.add(new KnotSpeedImpl(24.0));
|
||||
|
||||
// initialize beat-angles and -speeds
|
||||
SpeedWithBearing beatPort;
|
||||
@@ -100,10 +103,6 @@ public class PolarDiagramGPS extends PolarDiagramBase {
|
||||
jibeSpeed.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
if ((beatAngles.size() <= 1)||(beatSpeed.size() <= 1)||(jibeAngles.size() <= 1)||(jibeSpeed.size() <= 1)) {
|
||||
throw new SparseSimulationDataException();
|
||||
}
|
||||
|
||||
NavigableMap<Speed, NavigableMap<Bearing, Speed>> mapSpeedTable = new TreeMap<Speed, NavigableMap<Bearing, Speed>>();
|
||||
NavigableMap<Speed, Bearing> mapBeatAngles = new TreeMap<Speed, Bearing>();
|
||||
@@ -149,6 +148,10 @@ public class PolarDiagramGPS extends PolarDiagramBase {
|
||||
}
|
||||
}
|
||||
|
||||
if ((mapBeatAngles.size() <= 1)||(mapBeatSOG.size() <= 1)||(mapJibeAngles.size() <= 1)||(mapJibeSOG.size() <= 1)) {
|
||||
throw new SparseSimulationDataException();
|
||||
}
|
||||
|
||||
super.speedTable = mapSpeedTable;
|
||||
super.beatAngles = mapBeatAngles;
|
||||
super.jibeAngles = mapJibeAngles;
|
||||
|
||||
Reference in new issue
Block a user