Changed AWS, SOG and STW implementation to use kilometers per hour instead of knots as described in mail from Brent

This commit is contained in:
Simon Pamies
2014-06-12 14:54:13 +02:00
parent 4d5ee6b259
commit 22472ad8f2
4 changed files with 27 additions and 17 deletions
@@ -4,12 +4,20 @@ import java.util.Map;
import com.sap.sailing.domain.common.Speed;
import com.sap.sailing.domain.common.TimePoint;
import com.sap.sailing.domain.common.impl.KnotSpeedImpl;
import com.sap.sailing.domain.common.impl.KilometersPerHourSpeedImpl;
import com.sap.sailing.domain.igtimiadapter.IgtimiFixReceiver;
import com.sap.sailing.domain.igtimiadapter.Sensor;
/**
* Apparent wind speed, relative to the inertial system on which the wind speed was measured
* Apparent wind speed, relative to the inertial system on which the wind speed was measured.
* Speed is stored as kilometers per hour in the Igtimi database.
*
* Mail from Brent from June 10th 2014:
* The problem is units. We store everything in the database in SI units – so SOG, STW, and AWS are all in KPH instead of Knots.
* Simon, I think this explains the error you were seeing on the extreme 40 circuit as well. The reason that I didn’t identify this
* before is that I incorrectly thought we had everything in Knots – which is what I had told Axel as well. My apologies for that error.
* Note that your TW calculation will still be correct because the units for SOG and AWS (input for T-calcs) are both KPH.
* However the output will need to be divided by 1.852 if you want to see the results in Knots.
*
* @author Axel Uhl (d043530)
*
@@ -20,7 +28,7 @@ public class AWS extends Fix {
public AWS(TimePoint timePoint, Sensor sensor, Map<Integer, Object> valuesPerSubindex) {
super(sensor, timePoint);
apparentWindSpeed = new KnotSpeedImpl(((Number) valuesPerSubindex.get(1)).doubleValue());
apparentWindSpeed = new KilometersPerHourSpeedImpl(((Number) valuesPerSubindex.get(1)).doubleValue());
}
public Speed getApparentWindSpeed() {
@@ -4,13 +4,14 @@ import java.util.Map;
import com.sap.sailing.domain.common.Speed;
import com.sap.sailing.domain.common.TimePoint;
import com.sap.sailing.domain.common.impl.KnotSpeedImpl;
import com.sap.sailing.domain.common.impl.KilometersPerHourSpeedImpl;
import com.sap.sailing.domain.igtimiadapter.IgtimiFixReceiver;
import com.sap.sailing.domain.igtimiadapter.Sensor;
/**
* Speed over ground
* Speed over ground expressed in kilometers per hour
*
* @see AWS
* @author Axel Uhl (d043530)
*
*/
@@ -20,7 +21,7 @@ public class SOG extends Fix {
public SOG(TimePoint timePoint, Sensor sensor, Map<Integer, Object> valuesPerSubindex) {
super(sensor, timePoint);
speedOverGround = new KnotSpeedImpl(((Number) valuesPerSubindex.get(1)).doubleValue());
speedOverGround = new KilometersPerHourSpeedImpl(((Number) valuesPerSubindex.get(1)).doubleValue());
}
public Speed getSpeedOverGround() {
@@ -4,13 +4,14 @@ import java.util.Map;
import com.sap.sailing.domain.common.Speed;
import com.sap.sailing.domain.common.TimePoint;
import com.sap.sailing.domain.common.impl.KnotSpeedImpl;
import com.sap.sailing.domain.common.impl.KilometersPerHourSpeedImpl;
import com.sap.sailing.domain.igtimiadapter.IgtimiFixReceiver;
import com.sap.sailing.domain.igtimiadapter.Sensor;
/**
* Speed through water
* Speed through water expressed in kilometers per hour.
*
* @see AWS
* @author Axel Uhl (d043530)
*
*/
@@ -20,7 +21,7 @@ public class STW extends Fix {
public STW(TimePoint timePoint, Sensor sensor, Map<Integer, Object> valuesPerSubindex) {
super(sensor, timePoint);
speedThroughWater = new KnotSpeedImpl(((Number) valuesPerSubindex.get(1)).doubleValue());
speedThroughWater = new KilometersPerHourSpeedImpl(((Number) valuesPerSubindex.get(1)).doubleValue());
}
public Speed getSpeedThroughWater() {