signalk-polar-performance-plugin 0.0.26 → 0.0.28

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
@@ -43,12 +43,14 @@ In the plugin configuration you can toggle the following options:
43
43
  - Fill up the ends of the polar diagram
44
44
  - Visualisation of the polar diagram
45
45
  - Configurable damping alorithm on inputs
46
+ - Extrapolation of polar data towards 0
47
+ - Configurable overall performance adjustment ratio
46
48
 
47
49
  ### To-do list
48
50
  - Improved interpolation
49
51
  - Make moment to do calculation smarter/configurable
50
52
  - API to see JSON of polar
51
- - Extrapolation of polar data
53
+ - Extrapolation of polar data towards 50 kts?
52
54
  - Create polar from live data
53
55
  -- Save polar info to file
54
56
  -- 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.26",
3
+ "version": "0.0.28",
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
@@ -50,6 +50,12 @@ module.exports = function (app) {
50
50
  type: 'boolean',
51
51
  title: 'Enable writing of maximum speed angle and boat speed for a given TWS'
52
52
  },
53
+ perfAdjust: {
54
+ type: 'number',
55
+ description: 'This ratio allows you to lower the polar boat speeds in case you are not expecting to meet 100% due to e.g. weight. 1 = 100%, 0.8 = 80% etc',
56
+ title: 'Performance adjustment ratio',
57
+ default: 1
58
+ },
53
59
  dampingTWA: {
54
60
  type: 'number',
55
61
  description: 'If data appears erratic or too sensitive, damping may be applied to amke information appear more stable. With damping set to 0, the data is presented in raw form wih no damping applied.',
@@ -402,7 +408,7 @@ module.exports = function (app) {
402
408
  performance.polarSpeedRatio = BSP / performance.polarSpeed
403
409
  if (options.VMG == true) {
404
410
  performance.velocityMadeGood = Math.abs(BSP * Math.cos(TWA))
405
- performance.polarVelocityMadeGood = Math.abs(performance.polarSpeed * Math.cos(targetTWA))
411
+ performance.polarVelocityMadeGood = Math.abs(performance.targetVelocityMadeGood * Math.cos(targetTWA))
406
412
  performance.polarVelocityMadeGoodRatio = performance.velocityMadeGood / performance.polarVelocityMadeGood
407
413
  }
408
414
  } else {
@@ -462,7 +468,7 @@ module.exports = function (app) {
462
468
  for (let index = 0; index < row.length-1; index++) {
463
469
  if (row[index+1] != 0) {
464
470
  polar[index][angleName] = angle
465
- let tbs = ktsToMs(Number(row[index+1]))
471
+ let tbs = ktsToMs(Number(row[index+1])) * (options.perfAdjust || 1)
466
472
  let vmg = tbs * Math.abs(Math.cos(angle))
467
473
  polar[index][VMGName] = roundDec(vmg)
468
474
  if (typeof polar[index]['twa'] == 'undefined') {
@@ -483,7 +489,7 @@ module.exports = function (app) {
483
489
  if (typeof polar[index].twa == 'undefined') {
484
490
  polar[index].twa = []
485
491
  }
486
- let tbs = ktsToMs(Number(row[index+1]))
492
+ let tbs = ktsToMs(Number(row[index+1])) * (options.perfAdjust || 1)
487
493
  let vmg = tbs * Math.abs(Math.cos(angle))
488
494
  let Obj = {"twa": angle, "tbs": tbs, "vmg": vmg}
489
495
  // app.debug('Adding Obj: %s', JSON.stringify(Obj))