Giter Club home page Giter Club logo

signalk-derived-data's Introduction

Signal K

signal-k-logo-tagline

Signal K is a modern and open data format for marine use. Built on standard web technologies including JSON, WebSockets and HTTP, Signal K provides a method for sharing information in a way that is friendly to WiFi, cellphones, tablets and the Internet. A format available to everyone, where anyone can contribute, Signal K is the first truly open data format for the marine industry and is set to revolutionize how we consume and interact with data on boats.

https://signalk.org

signalk-derived-data's People

Contributors

chris0348 avatar cmotelet avatar davidsanner avatar fabdrol avatar godind avatar greenkeeper[bot] avatar ieb avatar jncarter123 avatar joabakk avatar jwallinder avatar kaapporaivio avatar matztam avatar mkbltz avatar panaaj avatar raffmont avatar rogerlittin avatar sbender9 avatar sergei avatar techstyleuk avatar tkurki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

signalk-derived-data's Issues

wind/angleTrue generated instead of wind/angleTrueGround and/or wind/angleTrueWater

trueWind.js code returns environment.wind.angleTrueWater.
However my Signal K Data Browser shows environment.wind.angleTrue.
Signal K plugin seems to be outdated (plugin config shows title "Derived Data with Polars, package name @ib236/signalk-derived-data) . When installing signalk-derived-data v 1.24.3, it does not show in in the Signal K Appstore/Installed and Data Browser still shows environment.wind.angleTrue.
This might be a Signal K Node Server problem. Created also SignalK/signalk-server#1006 (comment)

Wind Speed Over Ground

Hi!

Sorry if this is not an issue, that's my first time reporting here.
I use the derived data Wind Speed Over Ground, that (I guess) is calculated from Apparent Wind Speed (AWS) and probably Speed over Ground (SOG) as I don't have the loch feeding Signal-k,
I know that is not exactly the same as True Wind Speed (TWS) but I understand that with no current it should be close.
What I noticed is that when I'm upwind, WSoG is always higher than AWS, and when I'm downwind, WSoG is always lower than AWS.
That's not the way it should be, so I wonder if there is not an issue here.

Upwind screenshot
Screenshot_2022-07-30-02-47-53-219_com duckduckgo mobile android

LeewayAngle calculation

...
derivedFrom: [
'navigation.headingMagnetic',
'navigation.courseOverGroundTrue'
...
So always shows a magnetic difference, isn't navigation.headingTrue better?

Calculating for all contexts

It seems to me that it could be a good addition to be able to calculate derived data for not just the 'self' context, but all contexts, so for example you can calculate things like flag state from MMSI for received AIS targets.

What do you think? And if this is indeed a good addition, how could it be implemented?

Feature request. wind speed smooth with moving average

Create the posibility of create moving average values. wind angle has very different values... I have created a node red with moving average values to smooth values. Do you think that this is interesting for you? a lot of derived data values calculated are derived of wind speed and wind angle and smooth values gives more consistent values.

Collapse groups

This plugin configuration page is getting crowded, so perhaps it would be an idea to clean up the gui and collapse the groups?

Dew point algorithm does not return correct value

ACTUAL:
environment.outside.temperature | 305.9 (K)
environment.outside.humidity | 60.288 (RATIO)
environment.outside.dewPointTemperature | 401.05639938388276 (K)

EXPECTED:
outside.dewPointTemperature should be closer to 297 (K)

A fix could be to use a weather formula library I created some time back, and who supports several different algorithms and picks the best one based on different input ranges.
https://github.com/oyve/weather-formulas

Unknown format. at Geolib.useDecimal

Not sure if this comes from the derived data plugin, but SignalK throws an error in the server log:

Aug 17 12:48:43 Error: Unknown format. at Geolib.useDecimal (/home/pi/.signalk/node_modules/signalk-derived-data/node_modules/geolib/dist/geolib.js:1246:19) at Geolib.getLat (/home/pi/.signalk/node_modules/signalk-derived-data/node_modules/geolib/dist/geolib.js:148:78) at Geolib.latitude (/home/pi/.signalk/node_modules/signalk-derived-data/node_modules/geolib/dist/geolib.js:153:32) at Geolib.getDistanceSimple (/home/pi/.signalk/node_modules/signalk-derived-data/node_modules/geolib/dist/geolib.js:397:34) at calculator (/home/pi/.signalk/node_modules/signalk-derived-data/calcs/cpa_tcpa.js:209:30) at /home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1862:14 at Next.valueF (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:917:14) at Next.value (/usr/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:901:31) at spawn (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:2159:42) at Object.sink (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:2208:20) at Dispatcher.pushToSubscriptions (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1223:23) at Dispatcher.pushIt (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1245:10) at Object.inTransaction (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:430:16) at Dispatcher.push (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1214:24) at Dispatcher.handleEvent (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1267:17) at /home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:242:17 at Object.sink (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1717:18) at PropertyDispatcher.Dispatcher.pushToSubscriptions (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1223:23) at PropertyDispatcher.Dispatcher.pushIt (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1245:10) at Object.inTransaction (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:430:16) at PropertyDispatcher.Dispatcher.push (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1214:24) at PropertyDispatcher.push (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1655:38) at PropertyDispatcher._handleEvent (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:2858:21) at PropertyDispatcher.Dispatcher.handleEvent (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1265:17) at Object.sink (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:242:17) at PropertyDispatcher.Dispatcher.pushToSubscriptions (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1223:23) at PropertyDispatcher.Dispatcher.pushIt (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:1245:10) at Object.inTransaction (/home/pi/.signalk/node_modules/baconjs/dist/Bacon.js:430:16)

I have Freeboard open with an active route enabled. SignalK server 1.32 and version 1.25 derived data plugin.

TypeError: invalid lat ‘NaN’

Getting this error if GPS is not available. Although it's not fatal the message pollutes the /var/log/syslog so it would be nice not to have it

TypeError: invalid lat ‘NaN’
at new LatLonSpherical (/home/pi/.signalk/node_modules/@panaaj/sk-geodesy/latlon-spherical.js:50:31)
at calculator (/home/pi/.signalk/node_modules/signalk-derived-data/calcs/courseData.js:23:11)

closestApproach notification path does not include vessel uuid.

Traffic CPA / TCP code creates a notification to the following path:
'notifications.navigation.closestApproach.' + mmsi

which does not include the uuid of the vessel which I think is problematic on two fronts:

  1. Clients are unable to determine the vessel the notification is for
    and
  2. When the mmsi is not available it creates the following notification:
{
	"navigation":{
		"closestApproach":{
			"undefined":{
				"value":{
					"state":"alert",
					"method":["visual","sound"],
					"message":"Crossing vessel undefined 400 m away in 9.87  minutes",
					"timestamp":"2019-06-22T23:08:00.851Z"
				},
				"$source":"derived-data",
				"timestamp":"2019-06-22T23:08:00.852Z"
			}
		}
	}
}

Shouldn't the notification path be 'notifications.navigation.closestApproach.' + vessel?

True wind with leeway.

Hi,
I see the True wind doesn't account for leeway. Not sure if it should, but here is some code (originally in C++ running on an ArduinoDue) that does the calc. It uses a slightly different approach to the current True Wind calc. Has been checked and tested, but might have bugs.

function calcTrueWind(awa, aws, stw, leeway) {
  if ( leeway === undefined) {
    leeway = 0;
  }
  awa  = fixAngle(awa);
  var stw_lee = stw*Math.cos(leeway);
  var awa_lee = awa;
  if ( awa_lee > 0 ) {
    awa_lee = awa_lee +  leeway;
  } else {
    awa_lee = awa_lee +  leeway;         
  }
  // this should be a noop, but just in case the leeway downwind caused something wierd.
  awa_lee = fixAngle(awa_lee);

  var ctws = Math.sqrt((stw_lee*stw_lee+aws*aws)-(2*stw_lee*aws*Math.cos(awa_lee)));
  var ctwa = 0.0;
  if ( ctws > 1.0E-3 ) {
    ctwa = (aws*Math.cos(awa_lee)-stw_lee)/ctws;
    if ( ctwa > 0.9999 || ctwa < -0.9999) {
      ctwa = 0.0;
    } else {
      ctwa = Math.acos(ctwa);
    }
  }
  if ( awa_lee < 0.0) {
    ctwa = -ctwa;
  }
  return {
    angle : ctwa,
    speed : ctws
  };
}
function fixAngle(d) {
  if ( d > Math.PI ) d = d - Math.PI;
  if ( d < -Math.PI) d = d + Math.PI;
  return d;
}

Add Sun Times

signalk-derived-data already uses the suncalc library. Add the ability to display sunrise, sunset, and other times provided by the library.

navigation.​courseGreatCircle.​nextPoint.​bearingTrue​ to APB

Is there a way to forward this sentence to an APB sentences, in order to forward it to Pypilot?
I want to use an active route in Freeboard and push it to an autopilot, like Pypilot.
I see the sentence [-]navigation.​courseGreatCircle.​nextPoint.​bearingTrue​ (no_source) visualizes the correct heading until next waypoint, but I want to forward this value somehow.

Can this be done?

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

tankVolumes not active

It seems that after a few restructurings, the code for tank calibration is no longer fetched. Any debug messages in the calc are not shown, and the code is not executed

Feature request: Fuel flow rate calculated via RPM

Hi, I dont have a fuel flow meeter on my diesel engine that has send and return lines and very little consumption, thus making it an expensive device to buy or complex to make

Would it be possible to calculate fuel flow rate via RPMs and a table, EG:

For example for a Volvo Penta D2-75 this would be the consumption, have some input setup similar to the one that's created for tank shaping by adding 5-10 values of RMPS and their corresponding L/h

(Value at prop load)
Fuel system

Fuel consumption

wind.angleTrueWater and wind.speedTrue aren't being generated

Expected behaviour
The plugin should generate environment.wind.speedTrue and environment.wind.angleTrueWater from environment.wind.speedApparent, environment.wind.anleApparent, and navigation.speedThroughWater
Actual behaviour
Nothing is being generated by the plugin.
signall-Derived-data: no directionChangeAlarm value (sic) is being spammed into the console.

This is the available data generated by the simulator plugin:
image

This is what the plugin config looks like:

  "enabled": true,
  "enableLogging": false,
  "enableDebug": true,
  "configuration": {
    "default_ttl": 0,
    "engine_instances": "port, starboard",
    "battery_instances": "0",
    "tank_instances": "fuel.0, fuel.1",
    "air": {
      "Air density": false,
      "dewPoint": false,
      "Heat Index": false,
      "Wind Chill": false
    },
    "electrical": {
      "batterPower0": false
    },
    "traffic": {
      "CPA": false,
      "range": 1852,
      "timelimit": 30,
      "sendNotifications": true
    },
    "depth": {
      "belowKeel": false,
      "belowKeel_2": false,
      "belowSurface": false
    },
    "propulsion": {
      "economyport": false,
      "economystarboard": false,
      "propslipport": false,
      "propslipstarboard": false
    },
    "wind": {
      "groundWind": false,
      "trueWind": true,
      "directionTrue": true,
      "directionMagnetic2": false,
      "directionMagnetic": false,
      "windShift": true
    },
    "heading": {
      "heading": false,
      "leeway": false,
      "kFactor": 12
    },
    "moon": {
      "Moon": true
    },
    "sun": {
      "Sun": true,
      "Sun Time": false
    },
    "tanks": {
      "tankVolume_fuel.0": false,
      "volume_unit": "litres",
      "tankVolume_fuel.1": false
    },
    "vmg": {
      "vmg_Course": false,
      "vmg_Wind": true
    }
  }
}```

Feature Request: Distance to Vessel

Since the CPA/TCPA calculates the distance to each vessel, can it have the option to write that value? Three checkboxes so the user can select any combination of CPA, TCPA, and/or range.

Bearings as Direction [0,360] instead of Angles [-180,180]

Calculations for Course DTG, XTE, BRG, etc (based on courseGreatCircle.nextPoint / previousPoint) creates negative values for the bearingTrue and bearingMagnetic which is the calculated angle from North (0 Deg True) to the next point. So to get the compass bearing to steer to the next point you would have to subtract the value from 360. Shouldn't it always be a value (in Degrees) between 0 and 360? or expressed in radians 0 to 6.283185 (2xPi)? The negative numbers are seen only when the bearingTrue should be from 180 to 360. It seems to work right when its between 0 and 180. Both Freeboard and Kip don't have a way to convert the negative values back to the real heading you would need to know. Seems like a massive error in the plugin to me?

Bottom line... Shouldn't all course values be direction [0,360] in stead of angles [-180,180]

Timestamp derived data does not cater for source data going stale

When one of multiple sources for a derived value goes stale (does not receive updates anymore), but the other sources still update, the derived data is still calculated with fresh timestamps, although it is based on old sensor values, so to speak.

This would become an issue when data displays rely on timestamps to decide whether to give an indication of stale data, e.g. crossed out or empty display.

IMHO the timestamp of a derived value should be the minimum of the timestamps of all source values.

True Wind Speed option based on Speed Over Ground

Current True Wind speed module is based on speed through water (navigate.speedThroughWater) to calculate true wind speed. Not all vessels can generate speed through water (navigate.speedOverGround) so it would be nice to have the option to use speed over ground. Though this is not as accurate it would be a nice option.

Add Type Specific Path Values to Moon

Adjust the following path return types from string to:

  • "self.environment.moon.fraction" to type number
  • "self.environment.moon.phase" to type number
  • "self.environment.moon.angle" to type number
  • "self.environment.moon.times.alwaysUp" to type boolean
  • "self.environment.moon.times.alwaysDown" to type boolean

Flag state from MMSI

I believe it would be possible to derive the flag state (path: flag) from an object's MMSI number. Would this be a good addition?

Derived data plugin doesn't always generate paths if the source data came from another plugin

Situation
I have a plugin which generates SK paths. I use this to "inject" certain data into my SK setup (such as the distance between the keel and the depth transducer). I have set up signalk-derived-data to generate depth.belowKeel.

Expected behaviour
I expect to see depth values on the path depth.belowKeel.

Actual behaviour
depth.belowKeel is never generated

Notes
If I restart (untick and tick active) signalk-derived-data, the plugin starts generating data for depth.belowKeel. The issue thus only occurs if both plugins are started during the startup procedure of Node server.

Versions
Latest versions of signals-derived-data (1.24.3) and signalk-server-node (1.29) at the time of writing.

AIS CPA and TCPA calculation seem wrong

derived data plug in calculating CPA as 14,588 and TCPA as 40,956.
OpenCPN and SeaClear agree on CPA as 3.74NM and TCPA as 2hrs 48 minutes which I calculate at 6926 meters and 10,080 seconds.
Have I misunderstood the units?
Attached are the screenshots.

Screenshot 2020-05-01 at 19 20 22
Screenshot 2020-05-01 at 19 21 17

FEATURE REQUEST - Add Opposite Tack (Gybe) Angle

I've modified my trueWind Calculation file to compute the heading with the same apparent wind angle on the opposite Tack or Gybe as I am currently on in both True and Magnetic. Here is the code for someone to see if it's worthy of being added to the next release.

Thanks
trueWind.js.txt

Derived data sentences not in Data browser of SignalK

When using Freeboard with the derived data and sk-helper plugin, activating a route generates some SignalK sentences for Course Great Circle. The data for this can be seen in an app like Instrument panel, but the Data browser of SignalK does not visualize it. The Derived data "connection" is visible, but it says "0 keys". I have no filters for self or anything, so the Data browser should depect everything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.