Skip to content

Commit

Permalink
fix: Assign wind.angleTrueWater and wind.angleTrueGround identically …
Browse files Browse the repository at this point in the history
…to wind.angleApparent in case wind.speedApparent is smaller than 1e-9m/s (#74)

Set wind.angleTrueWater (TWA) and wind.angleTrueGround (GWA) identically to wind.angleApparent (AWA) in case wind.speedApparent (AWS) is smaller than 1e-9m/s. Background: Before for AWS=0 the plugin delivered wrong GWA and TWA since AWS=0 drove the arguments that are used for calculating the angles to zero.
  • Loading branch information
chris0348 authored Mar 25, 2021
1 parent 6700f48 commit 4632697
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions calcs/groundWind.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = function (app, plugin) {
var speed = Math.sqrt(
Math.pow(apparentY, 2) + Math.pow(-sog + apparentX, 2)
)

if (aws < 1e-9) {angle = awa}

return [
{ path: 'environment.wind.angleTrueGround', value: angle },
{ path: 'environment.wind.speedOverGround', value: speed }
Expand Down
2 changes: 2 additions & 0 deletions calcs/trueWind.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module.exports = function (app) {
Math.pow(apparentY, 2) + Math.pow(-speed + apparentX, 2)
)

if (aws < 1e-9) {angle = awa}

var dir = headTrue + angle

if (dir > Math.PI * 2) {
Expand Down

0 comments on commit 4632697

Please sign in to comment.