signalk-polar-performance-plugin 0.0.24 → 0.0.26

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
@@ -42,6 +42,7 @@ In the plugin configuration you can toggle the following options:
42
42
  - Wind angle for maximum speed at this wind speed
43
43
  - Fill up the ends of the polar diagram
44
44
  - Visualisation of the polar diagram
45
+ - Configurable damping alorithm on inputs
45
46
 
46
47
  ### To-do list
47
48
  - Improved interpolation
@@ -52,7 +53,6 @@ In the plugin configuration you can toggle the following options:
52
53
  -- Save polar info to file
53
54
  -- Save new record speed for angle in polar
54
55
  -- Determine if we're on a steady course to avoid fake records
55
- -- Dampening algoritms
56
56
  -- Configure the resolution of the polar diagram
57
57
  - Support multiple polar diagrams
58
58
  - Capture heel in polar diagram
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-polar-performance-plugin",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
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
@@ -402,7 +402,7 @@ module.exports = function (app) {
402
402
  performance.polarSpeedRatio = BSP / performance.polarSpeed
403
403
  if (options.VMG == true) {
404
404
  performance.velocityMadeGood = Math.abs(BSP * Math.cos(TWA))
405
- performance.polarVelocityMadeGood = Math.abs(performance.polarSpeed * Math.cos(TWA))
405
+ performance.polarVelocityMadeGood = Math.abs(performance.polarSpeed * Math.cos(targetTWA))
406
406
  performance.polarVelocityMadeGoodRatio = performance.velocityMadeGood / performance.polarVelocityMadeGood
407
407
  }
408
408
  } else {
@@ -546,6 +546,23 @@ module.exports = function (app) {
546
546
  }
547
547
 
548
548
  // And now fill in some missing ends to avoid doing expensive calculations in the main loop
549
+ if (polar[0].tws > 0) {
550
+ // Add a 0 line to allow interpolation at very low wind speeds
551
+ app.debug('Add a 0 line to allow interpolation at very low wind speeds')
552
+ let Obj = {
553
+ tws: 0.0001,
554
+ 'Beat angle': polar[0]['Beat angle'],
555
+ 'Beat VMG': polar[0]['Beat VMG'],
556
+ 'Run angle': polar[0]['Run angle'],
557
+ 'Run VMG': polar[0]['Run VMG'],
558
+ twa: []
559
+ }
560
+ Object.keys(polar[0].twa).forEach(twaObj => {
561
+ Obj.twa.push({twa: twaObj.twa, tbs: 0})
562
+ })
563
+ polar.unshift(Obj)
564
+ }
565
+
549
566
  for (let index = 0; index < polar.length; index++) {
550
567
  // Sorted on angle, so first is lowest
551
568
  let tws = polar[index].tws
@@ -568,7 +585,7 @@ module.exports = function (app) {
568
585
  polar[index].twa = topArray.concat(twaArray)
569
586
  }
570
587
 
571
- for (let index = 0; index < polar.length-1; index++) {
588
+ for (let index = 0; index < polar.length; index++) {
572
589
  let tws = polar[index].tws
573
590
  let twaArray = polar[index].twa
574
591
  let highTBS = twaArray[twaArray.length-1].tbs
@@ -635,6 +652,8 @@ module.exports = function (app) {
635
652
  data.datasets[index].pointRadius.push(radius)
636
653
  }
637
654
  }
655
+ // Remove 0 kts line
656
+ data.datasets.shift()
638
657
  return data
639
658
  }
640
659