This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get True Wind Direction instead of apparent using Signal K.
#28
I the haste to get the code working I mixed up Apparent and True angels... the proper code for getting the True Wind Direction in degrees based on True Wind Direction (in radians) should be:

Code:
module.exports = function (app) {
  return {
      group: 'wind',
      optionKey: 'directionTrueDeg',
      title: 'Stationary True Wind Direction in Degrees (based on AWA)',
      derivedFrom: ['environment.wind.angleTrueGround'],
      calculator: function (atg) {
        var windHeadingDeg = 0
        if (atg < 0) {
           windHeadingDeg = atg * (180 / Math.PI) + 360
        } else if (atg > 0) {
           windHeadingDeg = atg * (180 / Math.PI)
        }

        return [{ path: 'environment.wind.angleTrueGroundDeg', value: windHeadingDeg, units: 'deg'}]
      }
  }
}
Reply


Messages In This Thread
RE: How to get True Wind Direction instead of apparent using Signal K. - by Gryningsrad - 2022-08-07, 03:24 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)