Skip to content

Commit

Permalink
VMG using wind and speedThroughWater (#128)
Browse files Browse the repository at this point in the history
* VMG using wind and speedThroughWater
* remove unused conditional statement
  • Loading branch information
davidsanner authored Jan 4, 2024
1 parent ec806ac commit 90eabdb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 1 addition & 5 deletions calcs/vmg_wind.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }]
}
}
}
15 changes: 15 additions & 0 deletions calcs/vmg_wind_stw.js
Original file line number Diff line number Diff line change
@@ -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 } ]
}
}
}

0 comments on commit 90eabdb

Please sign in to comment.