signalk-auto-polar
v0.0.2
Published
Aggregates boat performance data into running averages per wind condition (with a capped count) and displays the results via a static HTML/JS interface with CSV download.
Maintainers
Readme
Automatic Polar Performance Aggregator
Overview
The Automatic Polar Performance Aggregator is a SignalK plugin that collects and aggregates boat performance data under various wind conditions to create a polar performance diagram. The plugin processes incoming sensor data (wind speed, wind angle, and boat speed) and assigns the data to specific wind condition bins. Each bin maintains a sliding window of recent boat speed measurements from which it calculates a moving average. This average is then used to update a "potential speed" for that bin using an upgrade/decay method.
How It Works
Synchronized Data Collection:
- The plugin listens for SignalK delta updates.
- It uses timestamps for each sensor reading to ensure that wind speed, wind angle, and boat speed are captured within a short window (one second by default).
- If the time difference between the oldest and newest sensor reading exceeds one second, outdated values are discarded. This guarantees that only a synchronized set of readings is processed.
Data Smoothing and Binning:
- Each sensor reading is cached until enough data points (defined by a smoothing factor) are collected.
- The averaged sensor values are binned based on wind speed (rounded to the nearest knot) and wind angle (rounded to the nearest 5°).
Potential Speed Calculation:
- For each bin, a sliding window (e.g., 60 data points representing about one minute) is maintained.
- A moving average is calculated from this window.
- Upgrade Logic: If the moving average exceeds the current stored potential speed, it is updated immediately.
- Decay Logic (Optional): If the moving average is lower than the stored value, the potential speed decays slowly (using a configurable decay factor). This helps prevent transient low readings from abruptly reducing the potential speed.
Data Persistence and Display:
- Aggregated data is periodically saved to a JSON file, ensuring persistence across restarts.
- The plugin provides HTTP endpoints for accessing a static web interface, JSON data, and CSV downloads of the polar performance data.
Why This Method?
Synchronized and Robust:
By ensuring that sensor readings are processed only if they are within one second of each other, the plugin minimizes the risk of processing asynchronous data. This leads to a more accurate representation of your boat's performance.Responsiveness:
A small sliding window captures current performance trends without the overhead of maintaining a long history, ensuring that the polar diagram reflects recent improvements.Efficiency:
The combination of moving averages, upgrade/decay logic, and time-based synchronization provides a robust measure of potential speed with minimal processing and memory overhead.
Installation
- Copy the plugin folder into your SignalK
pluginsdirectory. - Restart SignalK.
- Configure the plugin from the SignalK UI if needed (for example, adjusting the smoothing factor, sliding window size, or max time between values).
Usage
Once installed, the plugin automatically subscribes to the necessary SignalK paths and begins aggregating data. Access the plugin’s interface via:
- Web Interface:
[Your SignalK URL]/plugin/polar-performance - CSV Download:
[Your SignalK URL]/plugin/polar-performance/csv
This data can then be used to analyze your boat’s performance under varying wind conditions.
License
ISC License
This project is licensed under the ISC License, a permissive open-source license that is both simple and minimalistic. It grants you the freedom to use, copy, modify, and distribute the software for any purpose, including commercial applications, provided that the original copyright notice and permission text are included in all copies. The ISC License is functionally similar to the MIT and simplified BSD licenses, making it popular among developers for its clarity and minimal restrictions. By choosing this license, the project contributors aim to encourage widespread use and collaboration while providing the software "as is" without warranty or liability.
