signalk-polar-performance-plugin 0.0.3 → 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,14 +9,20 @@ 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
- ## Polar diagram
14
- Use the plugin config to configure the polar diagram.
15
- Simple interpolation will be used to get the corresponding values from the polar diagram info.
16
- For polar diagrams you can check [ORC sailboat data](https://jieter.github.io/orc-data/site/).
14
+ ## Plugin configuration
15
+ ### Polar diagram
16
+ The polar diagram can be configured through CSV notation as used on [ORC sailboat data](https://jieter.github.io/orc-data/site/).
17
+
18
+ ### Plugin options
19
+ In the plugin configuration you can toggle the following options:
20
+ - Enable calculation of beat/upwind and run/gybe/downwind angle
21
+ - Enable calculation of beat/upwind and run/gybe/downwind VMG
22
+ - Enable calculation of Optimal Wind Angle (difference between TWA and beat/run angle (depends on beat/run angle)
17
23
 
18
24
  ## Calculated performance data
19
- ### The following data is calculated
25
+ ### Currently supported
20
26
  - Upwind / beat angle (performance.beatAngle)
21
27
  - Downwind / run / gybe angle (performance.gybeAngle)
22
28
  - Upwind / beat VMG (performance.beatAngleVelocityMadeGood)
@@ -25,10 +31,10 @@ For polar diagrams you can check [ORC sailboat data](https://jieter.github.io/or
25
31
  - Optimal Wind Angle (diff between TWA and environment.wind.directionTrue)
26
32
  - Polar Boat Speed (performance.polarSpeed)
27
33
  - Polar Speed Ratio (performance.polarSpeedRatio)
34
+ - Plugin option to use SOG as boat speed
28
35
 
29
36
  ### To-do list
30
37
  - Fill up the ends of the polar diagram
31
- - A switch to use SOG as boat speed
32
38
  - Wind angle for maximum speed at this wind speed
33
39
  - Improved interpolation
34
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.3",
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)