diff --git a/calcs/vmg_wind.js b/calcs/vmg_wind.js index e9da3ec..53b731e 100644 --- a/calcs/vmg_wind.js +++ b/calcs/vmg_wind.js @@ -9,11 +9,7 @@ module.exports = function (app) { ], calculator: function (trueWindAngle, speedOverGround) { var vmg_wind = Math.cos(trueWindAngle) * speedOverGround - if (vmg_wind < 0) { - return [{ path: 'performance.velocityMadeGood', value: vmg_wind }] - } else { - return [{ path: 'performance.velocityMadeGood', value: vmg_wind }] - } + return [{ path: 'performance.velocityMadeGood', value: vmg_wind }] } } } diff --git a/calcs/vmg_wind_stw.js b/calcs/vmg_wind_stw.js new file mode 100644 index 0000000..3dfdf6e --- /dev/null +++ b/calcs/vmg_wind_stw.js @@ -0,0 +1,15 @@ +module.exports = function (app) { + return { + group: 'course data', + optionKey: 'vmg_Wind_STW', + title: + 'Velocity Made Good to wind (based on wind.angleTrueWater and speedThroughWater)', + derivedFrom: [ + 'environment.wind.angleTrueWater', + 'navigation.speedThroughWater' + ], + calculator: function (angleTrueWater, speedThroughWater) { + return [ { path: 'performance.velocityMadeGood', value: Math.cos(angleTrueWater) * speedThroughWater } ] + } + } +}