signalk-polar-performance-plugin 0.0.6 → 0.0.8
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 +10 -1
- package/package.json +1 -1
- package/plugin/index.js +17 -14
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# Polar performance plugin
|
|
2
2
|
Generate performance information based on a polar diagram.
|
|
3
3
|
|
|
4
|
+
|
|
5
|
+
## MFD configuration
|
|
6
|
+
|
|
7
|
+
### B&G
|
|
8
|
+
To make use of the performance data and get e.g. lay lines you need to set:
|
|
9
|
+
- Settings -> Chart -> Laylines -> Targets... -> True wind angle to 'Actual'
|
|
10
|
+
- SailSteer screen -> Long press tile to add 'Performance -> Target TWA -> decollapse, choose SignalK'
|
|
11
|
+
Now the Target TWA is coming from SignalK and the laylines will be drawn based on it's value.
|
|
12
|
+
|
|
4
13
|
## Data correctness
|
|
5
14
|
It's assumed data is already corrected when it's read by this plugin. This can be sometimes be done by the sensor, sometimes upon entry into SignalK using the [calibration plugin](https://www.npmjs.com/package/@signalk/calibration).
|
|
6
15
|
|
|
@@ -19,7 +28,7 @@ The polar diagram can be configured through CSV notation as used on [ORC sailboa
|
|
|
19
28
|
In the plugin configuration you can toggle the following options:
|
|
20
29
|
- Enable calculation of beat/upwind and run/gybe/downwind angle
|
|
21
30
|
- Enable calculation of beat/upwind and run/gybe/downwind VMG
|
|
22
|
-
- Enable calculation of
|
|
31
|
+
- Enable calculation of Optimum Wind Angle (difference between TWA and beat/run angle (depends on beat/run angle)
|
|
23
32
|
|
|
24
33
|
## Calculated performance data
|
|
25
34
|
### Currently supported
|
package/package.json
CHANGED
package/plugin/index.js
CHANGED
|
@@ -24,9 +24,9 @@ module.exports = function (app) {
|
|
|
24
24
|
type: 'boolean',
|
|
25
25
|
title: 'Enable calculation of beat/upwind and run/gybe/downwind VMG'
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
optimumWindAngle: {
|
|
28
28
|
type: 'boolean',
|
|
29
|
-
title: 'Enable calculation of
|
|
29
|
+
title: 'Enable calculation of Optimum Wind Angle (difference between TWA and beat/run angle (depends on beat/run angle)'
|
|
30
30
|
},
|
|
31
31
|
useSOG: {
|
|
32
32
|
type: 'boolean',
|
|
@@ -120,7 +120,7 @@ module.exports = function (app) {
|
|
|
120
120
|
} else if (delta.path == 'environment.wind.speedTrue') {
|
|
121
121
|
TWS = delta.value
|
|
122
122
|
// app.debug('environment.wind.speedTrue (TWS): %d', TWS)
|
|
123
|
-
app.debug('TWS: %d TWA: %d BSP: %d', TWS, TWA, BSP)
|
|
123
|
+
app.debug('TWS: %d TWA: %d BSP: %d', msToKts(TWS), radToDeg(TWA)*port, msToKts(BSP))
|
|
124
124
|
sendUpdates(getPerformanceData(TWS, TWA, BSP))
|
|
125
125
|
} else if (delta.path == 'environment.wind.angleTrueWater') {
|
|
126
126
|
if (delta.value < 0) {
|
|
@@ -129,7 +129,6 @@ module.exports = function (app) {
|
|
|
129
129
|
port = 1
|
|
130
130
|
}
|
|
131
131
|
TWA = Math.abs(delta.value)
|
|
132
|
-
// app.debug('environment.wind.angleTrueWater (TWA): %d', TWA)
|
|
133
132
|
}
|
|
134
133
|
})
|
|
135
134
|
}
|
|
@@ -143,6 +142,8 @@ module.exports = function (app) {
|
|
|
143
142
|
}
|
|
144
143
|
if (typeof perfObj.beatVMG != 'undefined') {
|
|
145
144
|
values.push({path: 'performance.beatAngleVelocityMadeGood', value: roundDec(perfObj.beatVMG)})
|
|
145
|
+
values.push({path: 'performance.targetVelocityMadeGood', value: roundDec(perfObj.beatVMG)})
|
|
146
|
+
metas.push({path: 'performance.targetVelocityMadeGood', value: {"units": "rad"}})
|
|
146
147
|
}
|
|
147
148
|
if (typeof perfObj.runAngle != 'undefined') {
|
|
148
149
|
values.push({path: 'performance.gybeAngle', value: roundDec(perfObj.runAngle)})
|
|
@@ -150,10 +151,12 @@ module.exports = function (app) {
|
|
|
150
151
|
}
|
|
151
152
|
if (typeof perfObj.runVMG != 'undefined') {
|
|
152
153
|
values.push({path: 'performance.gybeAngleVelocityMadeGood', value: roundDec(perfObj.runVMG)})
|
|
154
|
+
values.push({path: 'performance.targetVelocityMadeGood', value: roundDec(perfObj.runVMG)})
|
|
155
|
+
metas.push({path: 'performance.targetVelocityMadeGood', value: {"units": "rad"}})
|
|
153
156
|
}
|
|
154
|
-
if (typeof perfObj.
|
|
155
|
-
values.push({path: 'performance.
|
|
156
|
-
metas.push({path: 'performance.
|
|
157
|
+
if (typeof perfObj.optimumWindAngle != 'undefined') {
|
|
158
|
+
values.push({path: 'performance.optimumWindAngle', value: roundDec(perfObj.optimumWindAngle)})
|
|
159
|
+
metas.push({path: 'performance.optimumWindAngle', value: {"units": "rad"}})
|
|
157
160
|
}
|
|
158
161
|
if (typeof perfObj.targetSpeed != 'undefined') {
|
|
159
162
|
values.push({path: 'performance.targetSpeed', value: roundDec(perfObj.targetSpeed)})
|
|
@@ -201,9 +204,9 @@ module.exports = function (app) {
|
|
|
201
204
|
let beatUpper = polar[indexTWS+1]['Beat angle']
|
|
202
205
|
performance.beatAngle = beatLower + ((beatUpper - beatLower) * twsGapRatio)
|
|
203
206
|
}
|
|
204
|
-
// Calculate
|
|
205
|
-
if (options.
|
|
206
|
-
|
|
207
|
+
// Calculate optimum wind angle (B&G thing)
|
|
208
|
+
if (options.optimumWindAngle == true) {
|
|
209
|
+
performance.optimumWindAngle = (TWA - performance.beatAngle) * port
|
|
207
210
|
}
|
|
208
211
|
// Calculate beat VMG
|
|
209
212
|
if (options.beatVMG == true) {
|
|
@@ -220,9 +223,9 @@ module.exports = function (app) {
|
|
|
220
223
|
//app.debug('runLower: %s runUpper: %s', runLower, runUpper)
|
|
221
224
|
performance.runAngle = runLower + ((runUpper - runLower) * twsGapRatio)
|
|
222
225
|
}
|
|
223
|
-
if (options.
|
|
224
|
-
// Calculate
|
|
225
|
-
performance.
|
|
226
|
+
if (options.optimumWindAngle == true) {
|
|
227
|
+
// Calculate optimum wind angle
|
|
228
|
+
performance.optimumWindAngle = (performance.runAngle - TWA) * port * -1
|
|
226
229
|
}
|
|
227
230
|
if (options.beatVMG == true) {
|
|
228
231
|
// Calculate run VMG
|
|
@@ -398,7 +401,7 @@ function ktsToMs(knots) {
|
|
|
398
401
|
return knots / 1.94384
|
|
399
402
|
}
|
|
400
403
|
|
|
401
|
-
function
|
|
404
|
+
function msToKts(ms) {
|
|
402
405
|
return ms * 1.94384
|
|
403
406
|
}
|
|
404
407
|
|