signalk-polar-performance-plugin 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,6 +9,7 @@ The following paths are read
9
9
  - navigation.speedThroughWater
10
10
  - environment.wind.speedTrue
11
11
  - environment.wind.angleTrueWater
12
+ - navigation.speedOverGround (optional)
12
13
 
13
14
  ## Plugin configuration
14
15
  ### Polar diagram
@@ -30,10 +31,10 @@ In the plugin configuration you can toggle the following options:
30
31
  - Optimal Wind Angle (diff between TWA and environment.wind.directionTrue)
31
32
  - Polar Boat Speed (performance.polarSpeed)
32
33
  - Polar Speed Ratio (performance.polarSpeedRatio)
34
+ - Plugin option to use SOG as boat speed
33
35
 
34
36
  ### To-do list
35
37
  - Fill up the ends of the polar diagram
36
- - A switch to use SOG as boat speed
37
38
  - Wind angle for maximum speed at this wind speed
38
39
  - Improved interpolation
39
40
  - Make moment to do calculation smarter/configurable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-polar-performance-plugin",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "A plugin that calculates performance information based on a (CSV) polar diagram.",
5
5
  "main": "plugin/index.js",
6
6
  "scripts": {
package/plugin/index.js CHANGED
@@ -28,6 +28,10 @@ module.exports = function (app) {
28
28
  type: 'boolean',
29
29
  title: 'Enable calculation of Optimal Wind Angle (difference between TWA and beat/run angle (depends on beat/run angle)'
30
30
  },
31
+ useSOG: {
32
+ type: 'boolean',
33
+ title: 'Use speed over ground (SOG) as boat speed.'
34
+ },
31
35
  csvTable: {
32
36
  type: "string",
33
37
  title: "Enter csv with polar in http://jieter.github.io/orc-data/site/ style."
@@ -75,6 +79,14 @@ module.exports = function (app) {
75
79
  ]
76
80
  }
77
81
 
82
+ // Additional subscribes based on options
83
+ if (options.useSOG == true) {
84
+ localSubscription.subscribe.push({
85
+ path: 'navigation.speedOverGround',
86
+ policy: 'instant'
87
+ })
88
+ }
89
+
78
90
  app.subscriptionmanager.subscribe(
79
91
  localSubscription,
80
92
  unsubscribes,
@@ -97,6 +109,10 @@ module.exports = function (app) {
97
109
  STW = delta.value
98
110
  BSP = STW
99
111
  // app.debug('speedThroughWater (STW): %d', STW)
112
+ } else if (delta.path == 'navigation.speedOverGround') {
113
+ SOG = delta.value
114
+ BSP = SOG
115
+ // app.debug('speedThroughWater (STW): %d', STW)
100
116
  } else if (delta.path == 'environment.wind.speedTrue') {
101
117
  TWS = delta.value
102
118
  // app.debug('environment.wind.speedTrue (TWS): %d', TWS)