signalk-polar-performance-plugin 1.4.0 → 2.1.0
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/CHANGELOG.md +26 -0
- package/README.md +64 -84
- package/docs/developer-reference.md +34 -137
- package/openApi.json +12 -798
- package/package.json +14 -8
- package/plugin/index.js +298 -684
- package/public/app.js +53 -638
- package/public/index.html +0 -2
- package/public/plotter.html +20 -106
- package/test/lifecycle.test.js +90 -1
- package/test/outputs.test.js +304 -0
- package/test/routePolicyShim.js +42 -0
- package/docs/import.png +0 -0
- package/docs/polar.png +0 -0
- package/docs/polar_management.png +0 -0
- package/plugin/PolarFileStore.js +0 -133
- package/plugin/PolarTable.js +0 -924
- package/plugin/SI.js +0 -21
- package/plugin/import/ExpeditionImporter.js +0 -152
- package/plugin/import/FormatRegistry.js +0 -21
- package/plugin/import/ImportService.js +0 -199
- package/plugin/import/JieterImporter.js +0 -18
- package/plugin/import/OrcSource.js +0 -396
- package/plugin/import/SourceRegistry.js +0 -17
- package/plugin/import/canonical.js +0 -73
- package/plugin/import/matrixText.js +0 -133
- package/plugin/index.js.bak +0 -1003
- package/test/PolarFileStore.test.js +0 -216
- package/test/PolarTable.test.js +0 -464
- package/test/api.test.js +0 -507
- package/test/migration.test.js +0 -170
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
### Changed
|
|
10
|
+
- Requires signalk-server >=2.35.0 for the upstream metadata-first subscription fix ([SignalK/signalk-server#3216](https://github.com/SignalK/signalk-server/pull/3216)).
|
|
11
|
+
- Requires signalkutilities >=3.2.0 (subscriptions without cached-value replay, smoothers cleared by `null`) and polar-math >=1.1.1 (in-irons cutoff relative to the 25° curve endpoint).
|
|
12
|
+
- Read-only Signal K users can now access live values, status, active-polar display metadata, and polar curve queries used by the plotter. Curve resolution is bounded to at most 181 samples per request; settings remain administrator-only.
|
|
13
|
+
- Clearer `meta` descriptions for `performance.optimumWindAngle` (where the optimal angle comes from, what zero means) and `performance.polarVelocityMadeGood` (the polar's prediction, not the actual VMG).
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Removed idle-triggered input resubscriptions to avoid replaying cached values during sensor outages. Idle/stale warnings remain, and existing subscriptions receive data when the source resumes. Source changes and heading toggles still update subscriptions normally.
|
|
17
|
+
- Heading inputs enabled at runtime now use the same lifecycle-warning callbacks as heading inputs enabled at startup.
|
|
18
|
+
- When sailing in irons, all values taken from the polar (polar speed, target speed, target and polar VMG, beat/gybe angles and VMGs, max speed) and the percentages based on them are now cleared consistently. Previously some were cleared, some kept showing and VMG % froze on its last value. This also prevents spikes in the performance percentages while tacking. Steering advice (target angle, optimum wind angle, opposite tack heading) stays available so you can see how far to bear away. Everything returns as soon as you leave irons ([#38](https://github.com/htool/signalk-polar-performance-plugin/issues/38)).
|
|
19
|
+
- When pinching (between the in-irons cutoff and the beat angle), all outputs keep being published.
|
|
20
|
+
- Actual VMG keeps updating in irons instead of freezing on its last value.
|
|
21
|
+
- Performance outputs whose inputs become unavailable (for example missing boat speed, heading or polar targets) are now cleared instead of showing a stale value.
|
|
22
|
+
|
|
23
|
+
## [2.0.0] - 2026-09-09
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- External polar provider integration: subscribes to `polars.activePolar` and `polars.performanceFactor` from Signal K (published by a polar provider plugin such as `signalk-polar-management`), decoupling polar storage and file import from live compute.
|
|
27
|
+
- Integration with standalone `polar-math` package for core polar calculations, interpolation models, and target evaluations.
|
|
28
|
+
- Optional peer dependency declaration for `signalk-polar-management`.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Major architectural split: removed built-in polar file storage, file parsers/converters, and ORC database importing. All polar management is now handled by a dedicated polar provider plugin.
|
|
32
|
+
- Simplified webapp UI: removed polar management and import tabs; Overview tab and Plotter now display the active polar and its metadata from Signal K.
|
|
33
|
+
- Output path safety: output paths are cleanly nullified when no active polar is present or when required instrument inputs are unavailable.
|
|
34
|
+
|
|
9
35
|
## [1.4.0] - 2026-09-01
|
|
10
36
|
|
|
11
37
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
# Polar Performance — Signal K Plugin
|
|
2
2
|
|
|
3
|
-
Polar Performance
|
|
3
|
+
Polar Performance calculates live sailing performance metrics — target boat speeds, beat and run angles, target VMG, polar speed ratio, and optimum wind angles — in real time from your boat's instruments in Signal K. An integrated webapp and full-screen plotter let you inspect live values, target angles, and polar curves while sailing.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Architecture & Polar Providers
|
|
6
|
+
|
|
7
|
+
**Polar Performance works together with a polar provider plugin** (such as [signalk-polar-management](https://github.com/Asw1n/signalk-polar-management)).
|
|
8
|
+
|
|
9
|
+
Starting in version 2.0.0, polar file storage, file format conversion, ORC imports, and polar selection are decoupled from this compute plugin:
|
|
10
|
+
- **Polar Provider (`signalk-polar-management`):** Stores polar files, imports ORC/CSV/text polar files, manages polar metadata, and publishes the selected active polar to Signal K (`polars.activePolar`) along with any performance factor (`polars.performanceFactor`).
|
|
11
|
+
- **Performance Plugin (`signalk-polar-performance-plugin`):** Subscribes to the active polar and boat instrument data (TWS, TWA, STW/SOG), calculates real-time performance values using the [`polar-math`](https://github.com/Asw1n/polar-math) engine, and publishes the resulting performance metrics back to the Signal K delta stream.
|
|
12
|
+
|
|
13
|
+
When a polar lookup cannot be completed or required instrument data is missing/stale, output paths are cleanly set to `null` and the webapp status indicates the exact cause.
|
|
6
14
|
|
|
7
15
|
---
|
|
8
16
|
|
|
9
17
|
## Installation
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
Requires signalk-server >=2.35.0 for reliable metadata-first input subscriptions. Idle/stale warnings do not trigger resubscriptions; existing subscriptions receive data when the source resumes.
|
|
20
|
+
|
|
21
|
+
Install both plugins from the Signal K App Store, or via npm:
|
|
12
22
|
|
|
13
23
|
```sh
|
|
14
24
|
cd ~/.signalk
|
|
15
|
-
npm install signalk-polar-performance-plugin
|
|
25
|
+
npm install signalk-polar-performance-plugin signalk-polar-management
|
|
16
26
|
```
|
|
17
27
|
|
|
18
|
-
Then restart Signal K and enable
|
|
28
|
+
Then restart Signal K and enable both plugins in **Server → Plugin Config**. Without a polar resource provider installed and enabled, Polar Performance will wait for an active polar to be published and indicate this in its status.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## HTTP endpoint access
|
|
33
|
+
|
|
34
|
+
Signal K read-only users can view live values, status, active-polar display metadata, and polar curves used by the plotter. Plugin settings, including settings reads, require administrator access. Anonymous access remains controlled by the server's security configuration and is not enabled by this plugin. See the [developer reference](./docs/developer-reference.md#rest-api) for the endpoint list and access policies.
|
|
19
35
|
|
|
20
36
|
---
|
|
21
37
|
|
|
22
38
|
## Quick start
|
|
23
39
|
|
|
24
|
-
1. Open the webapp
|
|
25
|
-
2.
|
|
26
|
-
3.
|
|
27
|
-
4.
|
|
28
|
-
5. Enable the outputs you want in the **Outputs** tab.
|
|
40
|
+
1. Open the **Polar Management** webapp and import or select an active polar (and optionally set a performance factor).
|
|
41
|
+
2. Open the **Polar Performance** webapp from **Webapps → Polar Performance**.
|
|
42
|
+
3. The **Overview** tab shows the active polar's details, live performance numbers, and a polar diagram.
|
|
43
|
+
4. Enable the outputs you want in the **Outputs** tab.
|
|
29
44
|
|
|
30
45
|
---
|
|
31
46
|
|
|
@@ -35,36 +50,25 @@ The webapp is the primary interface for the plugin. Open it from the Signal K da
|
|
|
35
50
|
|
|
36
51
|
### Overview
|
|
37
52
|
|
|
38
|
-
|
|
53
|
+
Shows the currently active polar (name, boat type, sail number, year, source) and performance factor — read-only, selected in the polar management webapp — followed by a polar diagram on the left and live performance numbers on the right. The diagram shows a live TWS curve interpolated for the current wind speed, and two dots — the polar target speed (what the polar says you should be doing) and your actual boat speed — both at the current TWA. The targets section shows the beat and run angle and VMG interpolated from the polar for the current wind speed. Any data quality warnings appear at the bottom.
|
|
39
54
|
|
|
40
55
|
### Inputs
|
|
41
56
|
|
|
42
|
-
Shows the raw instrument values as they arrive from Signal K (before smoothing) and the smoothed values actually used for computation, side by side. Useful for spotting stale sensors or checking whether the smoother settings make sense for your data. Any missing inputs are listed as warnings.
|
|
57
|
+
Shows the raw instrument values as they arrive from Signal K (before smoothing) and the smoothed values actually used for computation, side by side. Useful for spotting stale sensors or checking whether the smoother settings make sense for your data. Smoother type/parameter and speed source are configured here. Any missing inputs are listed as warnings.
|
|
43
58
|
|
|
44
59
|
### Outputs
|
|
45
60
|
|
|
46
|
-
Shows the current value of each output path and lets you enable or disable each group with a toggle. Only enabled outputs are published to the Signal K bus.
|
|
47
|
-
|
|
48
|
-
### Settings
|
|
49
|
-
|
|
50
|
-
Lets you alter the settings of the plugin. Polar selection, performance adjustment, smoother type and parameter, and speed source. The polar diagram of the selected polar is shown.
|
|
61
|
+
Shows the current value of each output path and lets you enable or disable each group with a toggle. Only enabled outputs are published to the Signal K bus.
|
|
51
62
|
|
|
52
|
-
### Polars
|
|
53
|
-
|
|
54
|
-
Manage stored polars, import polars from the ORC database, and import text polars in supported formats.
|
|
55
63
|
---
|
|
56
64
|
|
|
57
65
|
## Configuration
|
|
58
66
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### Active polar
|
|
62
|
-
|
|
63
|
-
Select the polar to use for calculations. The polar diagram in the Settings tab updates when you change this. If no polar is selected the plugin runs but publishes nothing; any previously published values are nullified immediately.
|
|
67
|
+
Most configuration is done through the webapp.
|
|
64
68
|
|
|
65
|
-
###
|
|
69
|
+
### Active polar and performance factor
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
These are **not** configured here. Select the active polar and set the performance factor in the polar management webapp (e.g. signalk-polar-management); this plugin reads them from the `polars.activePolar` and `polars.performanceFactor` Signal K paths. If no polar is active, the plugin runs but publishes nothing; any previously published values are nullified immediately.
|
|
68
72
|
|
|
69
73
|
### Smoother
|
|
70
74
|
|
|
@@ -160,51 +164,28 @@ Requires `navigation.headingTrue` to be available.
|
|
|
160
164
|
|
|
161
165
|
Useful when you want downstream instruments to use the same smoothed values that drive the performance calculation.
|
|
162
166
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
## Managing polars
|
|
166
|
-
|
|
167
|
-
### Importing from ORC
|
|
168
|
-
|
|
169
|
-
The plugin can search the official ORC active certificate source directly. Go to **Polars → Import ORC Certificate**, type part of the certificate RefNo, boat name, class, or sail number and click Search. When you find your boat, click Import. The polar is saved locally and immediately available for selection.
|
|
170
|
-
|
|
171
|
-
Internet access is required only while searching or importing from ORC. In an isolated Signal K installation the ORC source is simply shown as unavailable; that is not treated as a plugin error. After import the polar is stored locally and no further internet access is needed.
|
|
172
|
-
|
|
173
|
-
### Importing text polars
|
|
167
|
+
### Output handling when pinching and in irons
|
|
174
168
|
|
|
175
|
-
|
|
169
|
+
The polar defines two zones above the beat angle:
|
|
176
170
|
|
|
177
|
-
|
|
171
|
+
- **Pinching** — TWA is between the in-irons cutoff and the beat angle. The boat is still sailing, and the polar curve is extended smoothly towards zero speed. **All outputs are published.**
|
|
172
|
+
- **In irons** — TWA is below the cutoff, which lies 80 % of the way from 25° to the beat angle (for example ~38.6° for a 42° beat angle). The polar has no sailing state here, so the outputs are handled per kind:
|
|
178
173
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
75;5.17;6.18;6.91;7.37;7.68;7.92;8.31
|
|
185
|
-
90;5.29;6.43;7.23;7.71;8.03;8.29;8.57
|
|
186
|
-
110;5.38;6.56;7.36;7.84;8.22;8.6;9.31
|
|
187
|
-
120;5.2;6.38;7.23;7.76;8.16;8.55;9.36
|
|
188
|
-
135;4.65;5.84;6.78;7.43;7.87;8.25;9.03
|
|
189
|
-
150;3.92;5.05;5.97;6.7;7.2;7.58;8.17
|
|
190
|
-
46.9;4.23;0;0;0;0;0;0
|
|
191
|
-
44.8;0;5.09;0;0;0;0;0
|
|
192
|
-
144.2;4.19;0;0;0;0;0;0
|
|
193
|
-
146.4;0;5.25;0;0;0;0;0
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Extrapolation
|
|
174
|
+
| Kind | Outputs | In irons |
|
|
175
|
+
|------|---------|----------|
|
|
176
|
+
| Measured | `velocityMadeGood`, `angleTrueWaterDamped`, `boatSpeedDamped` | Published |
|
|
177
|
+
| Steering advice | `targetAngle`, `optimumWindAngle`, `tackTrue` | Published, so you can see how far to bear away |
|
|
178
|
+
| Polar values and ratios based on them | `polarSpeed`, `polarSpeedRatio`, `targetSpeed`, `targetVelocityMadeGood`, `polarVelocityMadeGood`, `polarVelocityMadeGoodRatio`, `beatAngle`, `gybeAngle`, `beatAngleVelocityMadeGood`, `gybeAngleVelocityMadeGood`, `maxSpeed`, `maxSpeedAngle` | Set to `null` |
|
|
197
179
|
|
|
198
|
-
|
|
180
|
+
Clearing the polar values in irons also prevents spikes in the performance ratios while tacking. Through a tack the boat carries its speed head-to-wind while the polar speed falls towards zero, which would briefly drive the ratios to meaningless values. As soon as you bear away out of irons, all values return on the next wind update.
|
|
199
181
|
|
|
200
|
-
|
|
201
|
-
- **Deep downwind (run zone):** A cosine-VMG model extending 30 % of the angular gap between the run angle and dead downwind. Beyond this limit the plugin returns no value rather than extrapolate further.
|
|
182
|
+
A value is set to `null` once when it becomes unavailable and is not repeated until it returns.
|
|
202
183
|
|
|
203
|
-
|
|
184
|
+
---
|
|
204
185
|
|
|
205
|
-
|
|
186
|
+
## Managing polars
|
|
206
187
|
|
|
207
|
-
|
|
188
|
+
Polar storage, import (ORC, text formats), and active-polar/performance-factor selection are handled by a separate 'polars' resource-provider plugin, such as [signalk-polar-management](https://github.com/Asw1n/signalk-polar-management). See that plugin's documentation for import formats, the ORC certificate search, and extrapolation behaviour of the underlying `polar-math` library.
|
|
208
189
|
|
|
209
190
|
---
|
|
210
191
|
|
|
@@ -224,10 +205,22 @@ Install the [B&G Performance Plugin](https://www.npmjs.com/package/signalk-bandg
|
|
|
224
205
|
|
|
225
206
|
For laylines on charts: **Settings → Chart → Laylines → Targets → True wind angle → Actual**.
|
|
226
207
|
|
|
208
|
+

|
|
209
|
+
|
|
210
|
+
SailSteer screen -> Long press tile to add 'Performance -> Target TWA -> decollapse, choose SignalK':
|
|
211
|
+
|
|
212
|
+

|
|
213
|
+
|
|
214
|
+
Now the Target TWA is coming from SignalK and the laylines will be drawn based on its value:
|
|
215
|
+
|
|
216
|
+

|
|
217
|
+
|
|
227
218
|
### Garmin / Raymarine / other NMEA 2000
|
|
228
219
|
|
|
229
220
|
Use a Signal K → NMEA 2000 gateway plugin (such as `canboat` or `signalk-to-n2k`) to forward paths to the PGN fields your plotter expects for performance data. Consult your plotter's documentation for the relevant PGNs — most support Polar Speed, Target TWA, and VMG.
|
|
230
221
|
|
|
222
|
+
If you have a Raymarine MFD and can share setup instructions, please submit a PR or open an issue!
|
|
223
|
+
|
|
231
224
|
### OpenCPN / KIP / other Signal K displays
|
|
232
225
|
|
|
233
226
|
Subscribe directly to the paths listed in the Outputs section above.
|
|
@@ -253,9 +246,9 @@ The webapp shows warnings whenever something prevents accurate calculation:
|
|
|
253
246
|
| *True wind speed — no data* | `environment.wind.speedTrue` is not arriving from Signal K. |
|
|
254
247
|
| *True wind angle — no data* | `environment.wind.angleTrueWater` is not arriving. |
|
|
255
248
|
| *Boat speed — no data* | `navigation.speedThroughWater` (or SOG) is not arriving. |
|
|
256
|
-
| *No polar
|
|
257
|
-
| *Sailing in irons* | TWA is below the
|
|
258
|
-
| *Pinching* | TWA is between the
|
|
249
|
+
| *No active polar* | No `polars.activePolar` is published. Select an active polar in the polar management webapp. |
|
|
250
|
+
| *Sailing in irons* | TWA is below the in-irons cutoff. Polar values and the ratios based on them are set to `null`; measured values and steering advice keep updating. See [Output handling when pinching and in irons](#output-handling-when-pinching-and-in-irons). |
|
|
251
|
+
| *Pinching* | TWA is between the in-irons cutoff and the beat angle. All outputs are published; values come from the extrapolated beat zone. |
|
|
259
252
|
| *Extrapolated beyond run angle* | TWA is deeper than the run angle. Values come from the cosine-VMG extrapolation model. |
|
|
260
253
|
| *Wind speed below/above polar range* | TWS is outside the range covered by the polar. Values are extrapolated from the nearest TWS entry. |
|
|
261
254
|
|
|
@@ -273,28 +266,15 @@ Performance calculations are only as good as the inputs. A few things are worth
|
|
|
273
266
|
|
|
274
267
|
## For integrators and API users
|
|
275
268
|
|
|
276
|
-
If you want to
|
|
269
|
+
If you want to consume this plugin's live performance queries, use the developer reference:
|
|
277
270
|
|
|
278
|
-
- [Developer reference](docs/developer-reference.md) for the
|
|
271
|
+
- [Developer reference](docs/developer-reference.md) for the plugin REST API.
|
|
279
272
|
- [openApi.json](openApi.json) for the authoritative machine-readable contract.
|
|
273
|
+
- For the canonical `polarTable` structure, polar storage, and import, see [signalk-polar-management](https://github.com/Asw1n/signalk-polar-management) and the [polar-format](https://github.com/Asw1n/polar-format) / [polar-math](https://github.com/Asw1n/polar-math) packages it depends on.
|
|
280
274
|
|
|
281
275
|
---
|
|
282
276
|
|
|
283
277
|
## Known limitations
|
|
284
278
|
|
|
285
279
|
- Heel angle is not taken into account in the polar lookup. Most ORC polars are upright polars.
|
|
286
|
-
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-

|
|
290
|
-
|
|
291
|
-
- SailSteer screen -> Long press tile to add 'Performance -> Target TWA -> decollapse, choose SignalK'
|
|
292
|
-
|
|
293
|
-

|
|
294
|
-
|
|
295
|
-
Now the Target TWA is coming from SignalK and the laylines will be drawn based on it's value.
|
|
296
|
-
|
|
297
|
-

|
|
298
|
-
|
|
299
|
-
### Raymarine
|
|
300
|
-
If you have a Raymarine MFD and can tell more about this, please add to the README or tell me.
|
|
280
|
+
- Requires a 'polars' resource-provider plugin (e.g. `signalk-polar-management`) to be installed and running for polar storage, import, and active polar selection.
|
|
@@ -1,148 +1,45 @@
|
|
|
1
1
|
# Polar Performance Developer Reference
|
|
2
2
|
|
|
3
|
-
This document
|
|
3
|
+
This document covers the REST API this plugin still exposes. It no longer stores, imports,
|
|
4
|
+
or manages polar files — that is handled by a separate 'polars' resource-provider plugin
|
|
5
|
+
(e.g. [signalk-polar-management](https://github.com/Asw1n/signalk-polar-management)). For the
|
|
6
|
+
canonical `polarTable` format and its management API, see that plugin's documentation and the
|
|
7
|
+
[polar-format](https://github.com/Asw1n/polar-format) / [polar-math](https://github.com/Asw1n/polar-math)
|
|
8
|
+
packages it depends on.
|
|
4
9
|
|
|
5
10
|
For installation, day-to-day use, and webapp workflow, start with [../README.md](../README.md).
|
|
6
11
|
|
|
7
|
-
##
|
|
12
|
+
## How the active polar is resolved
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
This plugin subscribes to two Signal K paths published by the 'polars' resource provider:
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
- `polars.activePolar` — `{ href: '/resources/polars/<id>' }`, or absent if no polar is active.
|
|
17
|
+
- `polars.performanceFactor` — a number applied as a multiplier to all polar speeds.
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- `axes.tws` is a non-empty sorted array of true wind speeds in m/s.
|
|
18
|
-
- `axes.twa` is a non-empty sorted array of true wind angles in radians over the range `0..pi`.
|
|
19
|
-
- `values.boatSpeedMatrix` is a 2D array of boat speeds in m/s, indexed as `[twsRow][twaColumn]`.
|
|
20
|
-
- The number of matrix rows must match `axes.tws.length`.
|
|
21
|
-
- Each matrix row length must match `axes.twa.length`.
|
|
22
|
-
|
|
23
|
-
Optional metadata:
|
|
24
|
-
|
|
25
|
-
- `name`
|
|
26
|
-
- `sailnumber`
|
|
27
|
-
- `boatType`
|
|
28
|
-
- `year`
|
|
29
|
-
- `source`
|
|
30
|
-
- `notes`
|
|
31
|
-
|
|
32
|
-
Optional derived data:
|
|
33
|
-
|
|
34
|
-
- `derived.rows` can provide precomputed beat/run/max-speed targets for each TWS row.
|
|
35
|
-
- Each derived row uses the same TWS unit conventions as the main table.
|
|
36
|
-
- `beat` and `run` entries contain `twa`, `tbs`, and `vmg`, all in SI units.
|
|
37
|
-
|
|
38
|
-
Example:
|
|
39
|
-
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"kind": "polarTable",
|
|
43
|
-
"schemaVersion": "1.0.0",
|
|
44
|
-
"name": "Example Boat",
|
|
45
|
-
"sailnumber": "EX-1",
|
|
46
|
-
"boatType": "Example 36",
|
|
47
|
-
"year": 2025,
|
|
48
|
-
"source": "custom",
|
|
49
|
-
"notes": "Minimal canonical example",
|
|
50
|
-
"units": {
|
|
51
|
-
"tws": "m/s",
|
|
52
|
-
"twa": "rad",
|
|
53
|
-
"boatSpeed": "m/s"
|
|
54
|
-
},
|
|
55
|
-
"symmetry": {
|
|
56
|
-
"portStarboardSymmetric": true
|
|
57
|
-
},
|
|
58
|
-
"axes": {
|
|
59
|
-
"tws": [3.0864, 5.144],
|
|
60
|
-
"twa": [0.75398, 1.5708, 2.65465]
|
|
61
|
-
},
|
|
62
|
-
"values": {
|
|
63
|
-
"boatSpeedMatrix": [
|
|
64
|
-
[2.5051, 2.65465, 2.23368],
|
|
65
|
-
[3.16888, 3.34861, 2.74799]
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"derived": {
|
|
69
|
-
"rows": [
|
|
70
|
-
{
|
|
71
|
-
"tws": 3.0864,
|
|
72
|
-
"beat": { "twa": 0.75398, "tbs": 2.5051, "vmg": 1.82652 },
|
|
73
|
-
"run": { "twa": 2.65465, "tbs": 2.23368, "vmg": 1.97371 },
|
|
74
|
-
"maxSpeed": 2.65465,
|
|
75
|
-
"maxSpeedAngle": 1.5708
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Notes:
|
|
83
|
-
|
|
84
|
-
- The resource `id` is not part of the `PUT /polars/:id` body; it comes from the URL path.
|
|
85
|
-
- If `derived` is omitted, the plugin can still load and query the polar from the axis and matrix data alone.
|
|
86
|
-
- Text imports and ORC imports are converted into this canonical structure before being stored.
|
|
87
|
-
- The authoritative machine-readable schema is in [../openApi.json](../openApi.json) under `PolarResource` and `PolarResourceBody`.
|
|
19
|
+
On a change to `polars.activePolar`, the plugin resolves `<id>` via the in-process
|
|
20
|
+
`app.resourcesApi.getResource('polars', id)` call and builds a `polar-math` `Polar` instance
|
|
21
|
+
from the returned canonical document. If the resource provider or the active polar becomes
|
|
22
|
+
unavailable, the last successfully loaded polar is kept until a valid update arrives.
|
|
88
23
|
|
|
89
24
|
## REST API
|
|
90
25
|
|
|
91
|
-
The plugin exposes a REST API under `/plugins/signalk-polar-performance-plugin/`. Authentication
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
|
100
|
-
|
|
101
|
-
| `
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
|
106
|
-
|
|
107
|
-
| `GET` | `/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| `GET` | `/polars/:id` | Get a stored canonical `polarTable` resource. |
|
|
112
|
-
| `PUT` | `/polars/:id` | Create or replace a canonical `polarTable` resource. |
|
|
113
|
-
| `DELETE` | `/polars/:id` | Delete a stored polar. |
|
|
114
|
-
| `GET` | `/polars/:id/meta` | Read stored metadata and TWS range for a polar. |
|
|
115
|
-
|
|
116
|
-
### Query endpoints
|
|
117
|
-
|
|
118
|
-
| Method | Path | Description |
|
|
119
|
-
|--------|------|-------------|
|
|
120
|
-
| `GET` | `/polars/:id/axes/tws` | Array of TWS values (m/s) in a stored polar. |
|
|
121
|
-
| `GET` | `/polars/:id/queries/curve?tws=<m/s>&step=<rad>` | Interpolated polar curve for a given TWS, with beat and run markers. |
|
|
122
|
-
| `GET` | `/polars/:id/queries/speed?tws=<m/s>&twa=<rad>` | Interpolated boat speed and interpolation state for a single TWS/TWA point. |
|
|
123
|
-
| `GET` | `/polars/:id/queries/targets?tws=<m/s>` | Optimal beat and run targets for a given TWS. |
|
|
124
|
-
| `GET` | `/polars/:id/queries/performance?tws=<m/s>&twa=<rad>&bsp=<m/s>` | Speed and VMG performance ratios against the polar. |
|
|
125
|
-
|
|
126
|
-
### Import endpoints
|
|
127
|
-
|
|
128
|
-
| Method | Path | Description |
|
|
129
|
-
|--------|------|-------------|
|
|
130
|
-
| `GET` | `/imports/formats` | List supported text import formats. |
|
|
131
|
-
| `POST` | `/imports/text/:format` | Import a text polar and store it as a canonical resource. |
|
|
132
|
-
| `GET` | `/imports/sources` | List supported external sources and their current availability. |
|
|
133
|
-
| `GET` | `/imports/sources/:source/search?q=<text>` | Search an external source for import candidates. |
|
|
134
|
-
| `POST` | `/imports/sources/:source/items/:externalId` | Import a source item and store it as a canonical resource. |
|
|
135
|
-
|
|
136
|
-
## External source availability
|
|
137
|
-
|
|
138
|
-
External sources are optional. Signal K may run in an isolated environment, so lack of internet access is not treated as a plugin error.
|
|
139
|
-
|
|
140
|
-
- `GET /imports/sources` reports source availability through `available` and `availabilityMessage`.
|
|
141
|
-
- The ORC source is shown as unavailable when the plugin cannot reach the official ORC index within a short timeout.
|
|
142
|
-
- ORC imports do not accept manual metadata overrides; imported metadata is owned by the source data.
|
|
143
|
-
- Certificate search results may be served from a cached ORC active-certificate index.
|
|
144
|
-
|
|
145
|
-
## Source of truth
|
|
146
|
-
|
|
147
|
-
- Use [../openApi.json](../openApi.json) as the authoritative machine-readable API contract.
|
|
148
|
-
- Use this document for a human-readable overview of the canonical format and endpoint categories.
|
|
26
|
+
The plugin exposes a REST API under `/plugins/signalk-polar-performance-plugin/`. Authentication
|
|
27
|
+
follows Signal K server rules; the same session cookie used by the webapp works for direct API calls.
|
|
28
|
+
The endpoints marked **Read-only** are available to users with Signal K read-only permission.
|
|
29
|
+
Anonymous access is controlled only by the server's `allow_readonly` setting and is not enabled by
|
|
30
|
+
the plugin. Curve queries are capped at 181 sample angles per request (minimum step 1°).
|
|
31
|
+
`/meta` includes the active polar's boat type, sail number, source, and free-text notes, so those
|
|
32
|
+
fields are also available to read-only users.
|
|
33
|
+
|
|
34
|
+
| Method | Path | Description | Access |
|
|
35
|
+
|--------|------|-------------|--------|
|
|
36
|
+
| `GET` | `/live` | Current smoothed TWS, TWA, BSP, polar speed, and polar state. | Read-only |
|
|
37
|
+
| `GET` | `/status` | Full snapshot: raw inputs, smoothed inputs, and all enabled output values. | Read-only |
|
|
38
|
+
| `GET` | `/meta` | Display unit metadata for all fields, plus a read-only summary of the active polar (name, boatType, sailnumber, year, source) and performance factor. | Read-only |
|
|
39
|
+
| `GET` | `/settings` | Current plugin settings (smoother, output toggles, speed source — no polar selection). | Administrator |
|
|
40
|
+
| `PUT` | `/settings` | Update settings. Body: JSON object with changed keys only. | Administrator |
|
|
41
|
+
| `GET` | `/polar/axes/tws` | TWS axis of the currently active polar. 404 if none is active. | Read-only |
|
|
42
|
+
| `GET` | `/polar/queries/curve?tws=&step=` | Interpolated curve for the active polar at the given TWS, with beat/run markers, performance factor already applied. `step` must be at least 1° and at most π/2 radians. | Read-only |
|
|
43
|
+
|
|
44
|
+
The authoritative machine-readable schema for the two `/polar/*` endpoints is in
|
|
45
|
+
[../openApi.json](../openApi.json).
|