signalk-polar-performance-plugin 0.0.36 → 0.0.39
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 +2 -1
- package/package.json +5 -1
- package/plugin/index.js +7 -3
- package/public/index.html +11 -4
- package/public/logo.png +0 -0
- package/public/signalk-logo.png +0 -0
package/README.md
CHANGED
|
@@ -45,12 +45,13 @@ In the plugin configuration you can toggle the following options:
|
|
|
45
45
|
- Configurable damping alorithm on inputs
|
|
46
46
|
- Extrapolation of polar data towards 0
|
|
47
47
|
- Configurable overall performance adjustment ratio
|
|
48
|
+
- Dots in webapp indicating Polar Speed and Boat Speed
|
|
49
|
+
- Use highest polar speed when going north of Polar
|
|
48
50
|
|
|
49
51
|
### To-do list
|
|
50
52
|
- Improved interpolation
|
|
51
53
|
- Make moment to do calculation smarter/configurable
|
|
52
54
|
- API to see JSON of polar
|
|
53
|
-
- Extrapolation of polar data towards 50 kts?
|
|
54
55
|
- Create polar from live data
|
|
55
56
|
-- Save polar info to file
|
|
56
57
|
-- Save new record speed for angle in polar
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "signalk-polar-performance-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "A plugin that calculates performance information based on a (CSV) polar diagram.",
|
|
5
5
|
"main": "plugin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"url": "https://github.com/htool/signalk-polar-performance-plugin/issues"
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/htool/signalk-polar-performance-plugin#readme",
|
|
19
|
+
"signalk": {
|
|
20
|
+
"appIcon": "./signalk-logo.png",
|
|
21
|
+
"displayName": "Polar Performance"
|
|
22
|
+
},
|
|
19
23
|
"keywords": [
|
|
20
24
|
"signalk-webapp",
|
|
21
25
|
"signalk-node-server-plugin",
|
package/plugin/index.js
CHANGED
|
@@ -163,14 +163,14 @@ module.exports = function (app) {
|
|
|
163
163
|
function handleDelta (deltas) {
|
|
164
164
|
deltas.forEach(delta => {
|
|
165
165
|
// app.debug('handleData: %s', JSON.stringify(delta))
|
|
166
|
-
if (delta.path == 'navigation.speedThroughWater') {
|
|
166
|
+
if (delta.path == 'navigation.speedThroughWater' && options.useSOG == false) {
|
|
167
167
|
STW = applyDamping (delta.value, 'STW', options.dampingBSP || 0)
|
|
168
168
|
BSP = STW
|
|
169
169
|
// app.debug('speedThroughWater (STW): %d', STW)
|
|
170
|
-
} else if (delta.path == 'navigation.speedOverGround') {
|
|
170
|
+
} else if (delta.path == 'navigation.speedOverGround' && options.useSOG == true) {
|
|
171
171
|
SOG = applyDamping (delta.value, 'SOG', options.dampingBSP || 0)
|
|
172
172
|
BSP = SOG
|
|
173
|
-
// app.debug('
|
|
173
|
+
// app.debug('speedOverGround (SOG): %d', SOG)
|
|
174
174
|
} else if (delta.path == 'navigation.headingTrue') {
|
|
175
175
|
HDG = delta.value
|
|
176
176
|
// app.debug('heading (HDG): %d', HDG)
|
|
@@ -276,6 +276,10 @@ module.exports = function (app) {
|
|
|
276
276
|
for (let indexTWS = 0 ; indexTWS < polar.length-1; indexTWS++) {
|
|
277
277
|
let lower = polar[indexTWS].tws
|
|
278
278
|
let upper = polar[indexTWS+1].tws
|
|
279
|
+
if (indexTWS == polar.length-1 && TWS > upper) {
|
|
280
|
+
// North of polar
|
|
281
|
+
TWS = upper
|
|
282
|
+
}
|
|
279
283
|
if (TWS >= lower && TWS <= upper) {
|
|
280
284
|
//app.debug('TWS between %d and %d', lower, upper)
|
|
281
285
|
// Calculate gap ratio
|
package/public/index.html
CHANGED
|
@@ -195,16 +195,16 @@ function handleData (data) {
|
|
|
195
195
|
var value = data.updates[0].values[0].value
|
|
196
196
|
|
|
197
197
|
if (path == 'performance.polarSpeed') {
|
|
198
|
-
polarSpeed = msToKts(value)
|
|
198
|
+
polarSpeed = roundDec(msToKts(value), 1)
|
|
199
199
|
// console.log('polarSpeed set to %s', polarSpeed)
|
|
200
200
|
chartData.datasets[0].data[0].y = polarSpeed
|
|
201
201
|
} else if (path == 'environment.wind.angleTrueWaterDamped') {
|
|
202
|
-
TWA = radToDeg(value)
|
|
202
|
+
TWA = roundDec(radToDeg(value),1)
|
|
203
203
|
// console.log('TWA set to %s', TWA)
|
|
204
204
|
chartData.datasets[0].data[0].x = TWA
|
|
205
205
|
chartData.datasets[1].data[0].x = TWA
|
|
206
206
|
} else if (path == 'performance.boatSpeedDamped') {
|
|
207
|
-
boatSpeed = msToKts(value)
|
|
207
|
+
boatSpeed = roundDec(msToKts(value),1)
|
|
208
208
|
// console.log('boatSpeed set to %s', boatSpeed)
|
|
209
209
|
chartData.datasets[1].data[0].y = boatSpeed
|
|
210
210
|
}
|
|
@@ -227,7 +227,14 @@ function msToKts(ms) {
|
|
|
227
227
|
return ms * 1.94384
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
function roundDec (value, decimals) {
|
|
231
|
+
if (typeof value == 'undefined') {
|
|
232
|
+
return undefined
|
|
233
|
+
} else {
|
|
234
|
+
value = Number(value.toFixed(decimals))
|
|
235
|
+
return value
|
|
236
|
+
}
|
|
237
|
+
}
|
|
231
238
|
|
|
232
239
|
</script>
|
|
233
240
|
|
package/public/logo.png
ADDED
|
Binary file
|
|
Binary file
|