openc3-cosmos-constellation 0.8.2 → 0.8.3
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.
- checksums.yaml +4 -4
- data/Rakefile +3 -3
- data/microservices/BRIDGE/bridge.py +4 -3
- data/targets/CONSTELLATION/cmd_tlm/tlm.txt +3 -3
- data/tools/constellationforecast/forecast-view.js +23 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad3cbfc7648b177285a954c17e4c592c254862d2c0e79f128526b4dad52957f9
|
|
4
|
+
data.tar.gz: ff7be196ea8274ab1b35dc13194dab2b1d34b80f72bea88b8c3a24208d7c0869
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afefedd0cefea489de19b2ee79118567b602cea73dbc52ad47b26934cb9624950af4cc2915015bfb87d8ab1e86d7f5c0d7861f6b768e5693a39e8e13a9968149
|
|
7
|
+
data.tar.gz: 6c4e10555ffa3ff8127ccae734e5ca63c10e7a920c5816cf557490c2ae54d2f5576fce8ee5d0143aa3b7dd894198b25253f0c1f595cd3aa159976892bbaef687
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Builds openc3-cosmos-constellation-<VERSION>.gem: rake build VERSION=0.8.
|
|
2
|
-
# (or ./openc3.sh cli rake build VERSION=0.8.
|
|
1
|
+
# Builds openc3-cosmos-constellation-<VERSION>.gem: rake build VERSION=0.8.3
|
|
2
|
+
# (or ./openc3.sh cli rake build VERSION=0.8.3 inside a COSMOS checkout).
|
|
3
3
|
PLUGIN_NAME = Dir['*.gemspec'][0].split('.')[0..-2].join('.')
|
|
4
4
|
|
|
5
5
|
# The tool draws the shared Constellation Forecast view, copied in from this repo when it is here.
|
|
@@ -13,7 +13,7 @@ SHARED_RESULTS = '../../clients/python/src/constellation_space/results.py'
|
|
|
13
13
|
SHARED_LICENSE = '../../LICENSE'
|
|
14
14
|
|
|
15
15
|
task :build do
|
|
16
|
-
abort('VERSION is required: rake build VERSION=0.8.
|
|
16
|
+
abort('VERSION is required: rake build VERSION=0.8.3') unless ENV['VERSION']
|
|
17
17
|
FileUtils.cp(SHARED_VIEW, VIEW) if File.exist?(SHARED_VIEW)
|
|
18
18
|
abort("#{VIEW} is missing: copy bridges/shared/forecast-view.js there") unless File.exist?(VIEW)
|
|
19
19
|
if File.exist?(SHARED_RESULTS)
|
|
@@ -38,7 +38,7 @@ from typing import Any
|
|
|
38
38
|
|
|
39
39
|
from constellation_space import results
|
|
40
40
|
|
|
41
|
-
VERSION = "0.8.
|
|
41
|
+
VERSION = "0.8.3"
|
|
42
42
|
TARGET = "CONSTELLATION"
|
|
43
43
|
POLL_S = int(os.environ.get("POLL_SECONDS", "15"))
|
|
44
44
|
# COSMOS shows a packet stale 30 s after its last value: re-inject every poll so a quiet feed
|
|
@@ -321,9 +321,10 @@ def modcod_plans(items: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
|
321
321
|
|
|
322
322
|
def modcod_packet(items: list[dict[str, Any]], now: datetime) -> dict[str, Any] | None:
|
|
323
323
|
"""MODCOD: the next pass's MODCOD plan, its changes and its lowest SINR at a change (the series
|
|
324
|
-
holds only the changes).
|
|
324
|
+
holds only the changes). The next AOS, as NEXT_PASS has it: a pass under way is not next.
|
|
325
|
+
None without a plan ahead."""
|
|
325
326
|
plans = sorted(
|
|
326
|
-
(p for p in modcod_plans(items) if datetime.fromisoformat(p["
|
|
327
|
+
(p for p in modcod_plans(items) if datetime.fromisoformat(p["target_at"]) > now),
|
|
327
328
|
key=lambda p: p["target_at"],
|
|
328
329
|
)
|
|
329
330
|
if not plans:
|
|
@@ -43,7 +43,7 @@ TELEMETRY CONSTELLATION SWAP BIG_ENDIAN "Forecast: the soonest open rain-fade sw
|
|
|
43
43
|
APPEND_ITEM BACKUP_ANTENNA 512 STRING "Antenna to book instead, or NONE"
|
|
44
44
|
APPEND_ITEM BACKUP_AOS 256 STRING "Backup pass AOS, UTC"
|
|
45
45
|
APPEND_ITEM DEADLINE 256 STRING "Cancel the original by, UTC"
|
|
46
|
-
APPEND_ITEM MINUTES_TO_DEADLINE 32 FLOAT "Minutes left to decide (99999 when no swap is open)"
|
|
46
|
+
APPEND_ITEM MINUTES_TO_DEADLINE 32 FLOAT "Minutes left to decide: yellow at 30 or less, red at 15 or less (99999 when no swap is open)"
|
|
47
47
|
UNITS Minutes min
|
|
48
48
|
FORMAT_STRING "%.1f"
|
|
49
49
|
LIMITS DEFAULT 1 ENABLED 15 30 100000 100000
|
|
@@ -75,13 +75,13 @@ TELEMETRY CONSTELLATION MODCOD BIG_ENDIAN "Forecast: the next pass's MODCOD plan
|
|
|
75
75
|
APPEND_ITEM SATELLITE 512 STRING "Satellite id"
|
|
76
76
|
APPEND_ITEM ANTENNA 512 STRING "Antenna id"
|
|
77
77
|
APPEND_ITEM AOS 256 STRING "Predicted AOS, UTC"
|
|
78
|
-
APPEND_ITEM CHANGES 32 UINT "MODCOD changes over the pass"
|
|
78
|
+
APPEND_ITEM CHANGES 32 UINT "MODCOD changes over the pass, after the one at AOS"
|
|
79
79
|
APPEND_ITEM FIRST 256 STRING "MODCOD at AOS"
|
|
80
80
|
APPEND_ITEM LAST 256 STRING "MODCOD at LOS"
|
|
81
81
|
APPEND_ITEM MIN_SINR_DB 32 FLOAT "Lowest planned SINR (p50) at a MODCOD change"
|
|
82
82
|
UNITS Decibels dB
|
|
83
83
|
FORMAT_STRING "%.2f"
|
|
84
|
-
APPEND_ITEM PLANNED_PASSES 32 UINT "Passes with a plan
|
|
84
|
+
APPEND_ITEM PLANNED_PASSES 32 UINT "Passes ahead with a plan"
|
|
85
85
|
|
|
86
86
|
TELEMETRY CONSTELLATION RUN BIG_ENDIAN "The latest workflow run received, of any kind: each other packet holds the newest run of its own kind"
|
|
87
87
|
ALLOW_SHORT
|
|
@@ -57,6 +57,9 @@ const gbOf = (item) => {
|
|
|
57
57
|
const g = typeof ledger?.p50 === 'number' ? ledger : item.value;
|
|
58
58
|
return g && typeof g.p50 === 'number' ? g : null;
|
|
59
59
|
};
|
|
60
|
+
// A MODCOD plan's series holds each switch, the first at AOS: its changes are the steps after it,
|
|
61
|
+
// as the COSMOS MODCOD packet's CHANGES and the Lattice bridge count them.
|
|
62
|
+
const changes = (series) => `${series.length - 1} change${series.length === 2 ? '' : 's'}`;
|
|
60
63
|
const ledgerOf = (item) => item.explain?.ledger?.value || {};
|
|
61
64
|
// A pass's max elevation: the ledger entry the orbit wrote, under whichever node wrote it.
|
|
62
65
|
const elevationOf = (item) =>
|
|
@@ -119,7 +122,7 @@ function bandChart(buckets, { height = 180, unit = 'GB' } = {}) {
|
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
/** Horizontal bars with p10 to p90 whiskers, one row per key. */
|
|
122
|
-
function rangeBars(rows, { unit = 'GB' } = {}) {
|
|
125
|
+
function rangeBars(rows, { unit = 'GB', digits = 1 } = {}) {
|
|
123
126
|
const rowH = 20;
|
|
124
127
|
const pad = { l: 128, r: 56, t: 4 };
|
|
125
128
|
const h = pad.t + rows.length * rowH;
|
|
@@ -133,7 +136,7 @@ function rangeBars(rows, { unit = 'GB' } = {}) {
|
|
|
133
136
|
r.p10 !== undefined
|
|
134
137
|
? `<line class="cf-whisker" x1="${x(r.p10)}" x2="${x(r.p90)}" y1="${y + rowH / 2}" y2="${y + rowH / 2}"/>`
|
|
135
138
|
: '';
|
|
136
|
-
return `<g ${tip(r.tip ?? `${r.label}: ${num(value)} ${unit}`)}><text class="cf-label" x="${pad.l - 8}" y="${y + rowH / 2 + 4}" text-anchor="end">${esc(r.label)}</text><rect class="cf-bar${r.warn ? ' cf-bar-warn' : ''}" x="${pad.l}" y="${y + 6}" width="${Math.max(x(value) - pad.l, 2)}" height="${rowH - 12}" rx="2"/>${whisker}<text class="cf-value" x="${x(r.p90 ?? value) + 6}" y="${y + rowH / 2 + 4}">${
|
|
139
|
+
return `<g ${tip(r.tip ?? `${r.label}: ${num(value)} ${unit}`)}><text class="cf-label" x="${pad.l - 8}" y="${y + rowH / 2 + 4}" text-anchor="end">${esc(r.label)}</text><rect class="cf-bar${r.warn ? ' cf-bar-warn' : ''}" x="${pad.l}" y="${y + 6}" width="${Math.max(x(value) - pad.l, 2)}" height="${rowH - 12}" rx="2"/>${whisker}<text class="cf-value" x="${x(r.p90 ?? value) + 6}" y="${y + rowH / 2 + 4}">${num(value, digits)}</text></g>`;
|
|
137
140
|
})
|
|
138
141
|
.join('');
|
|
139
142
|
return `<svg class="cf-chart" viewBox="0 0 ${W} ${h}" role="img" aria-label="Values per row">${body}</svg>`;
|
|
@@ -153,7 +156,7 @@ function heatGrid(rows, cols, cell, { unit = 'GB' } = {}) {
|
|
|
153
156
|
.map((c, j) => {
|
|
154
157
|
const v = cell(r, c);
|
|
155
158
|
const share = v ? v.value / max : 0;
|
|
156
|
-
const label = v && cw > 48 ? `<text class="cf-heat-label${share > 0.55 ? ' cf-on-dark' : ''}" x="${pad.l + j * cw + cw / 2}" y="${pad.t + i * ch + 15}" text-anchor="middle">${
|
|
159
|
+
const label = v && cw > 48 ? `<text class="cf-heat-label${share > 0.55 ? ' cf-on-dark' : ''}" x="${pad.l + j * cw + cw / 2}" y="${pad.t + i * ch + 15}" text-anchor="middle">${num(v.value)}</text>` : '';
|
|
157
160
|
return `<g ${tip(v ? `${r} · ${c}: ${num(v.value)} ${unit}, ${v.detail}` : `${r} · ${c}: no passes`)}><rect class="cf-heat" x="${pad.l + j * cw + 1}" y="${pad.t + i * ch + 1}" width="${cw - 2}" height="${ch - 2}" rx="3" style="--share:${share.toFixed(3)}"/>${label}</g>`;
|
|
158
161
|
})
|
|
159
162
|
.join('');
|
|
@@ -264,6 +267,8 @@ export function actionState(item) {
|
|
|
264
267
|
/** A swap to show: advice, or approved in Constellation; never one held or rejected. */
|
|
265
268
|
const actionable = (i) => actionState(i) === 'advice' || actionState(i) === 'approved';
|
|
266
269
|
|
|
270
|
+
// A probability or share column reads as a percent, as the lock-loss risk does.
|
|
271
|
+
const SHARES = ['probability', 'share'];
|
|
267
272
|
// rfi-watch items are links whose value is RFI in dB (p10/p50/p90) with a lock-loss risk (a
|
|
268
273
|
// share), and whose action is a reroute with no deadline: never GB, never a swap.
|
|
269
274
|
const pct = (v) => (typeof v === 'number' ? `${Math.round(v * 100)}%` : num(v));
|
|
@@ -400,7 +405,7 @@ export const VIEWS = {
|
|
|
400
405
|
const mix = new Map();
|
|
401
406
|
for (const item of items) for (const s of item.series || []) mix.set(s.value.modcod, (mix.get(s.value.modcod) || 0) + 1);
|
|
402
407
|
const rows = [...mix.entries()].sort((a, b) => b[1] - a[1]).slice(0, 12).map(([label, value]) => ({ label, value, tip: `${label}: chosen ${value} times across the plan` }));
|
|
403
|
-
return section('MODCOD mix across the plan', rangeBars(rows, { unit: 'steps' }), 'How often each MODCOD is planned. Select a pass below to see its own plan.');
|
|
408
|
+
return section('MODCOD mix across the plan', rangeBars(rows, { unit: 'steps', digits: 0 }), 'How often each MODCOD is planned. Select a pass below to see its own plan.');
|
|
404
409
|
}
|
|
405
410
|
return section('Expected GB over the next 24 hours', bandChart(hourly(items)), 'The line is the median (p50); the band runs from the wet tail (p10) to the best case (p90). Hover an hour for its passes.');
|
|
406
411
|
},
|
|
@@ -467,7 +472,7 @@ export const VIEWS = {
|
|
|
467
472
|
? `<td>${minute(i.target_at)}</td><td>${esc(linkLabel(i))}</td><td class="cf-num">${num(ledgerOf(i).delivered_gb)} / ${num(ledgerOf(i).possible_gb)}</td><td>${ledgerOf(i).dead ? `<span class="cf-status-warn">▲</span> ${esc(ledgerOf(i).status)}` : esc(ledgerOf(i).status)}</td>`
|
|
468
473
|
: run.kind === 'antenna-capacity'
|
|
469
474
|
? `<td>${esc(i.target_at.slice(0, 10))}</td><td>${esc(i.entity.id)}</td><td class="cf-num">${num(g?.p10)} / <b>${num(g?.p50)}</b> / ${num(g?.p90)}</td><td>${esc(gbOf(i)?.passes)} · ${num(gbOf(i)?.sellable_min, 0)} min</td>`
|
|
470
|
-
: `<td>${minute(i.target_at)}</td><td>${esc(linkLabel(i))}</td><td class="cf-num">${num(g?.p10)} / <b>${num(g?.p50)}</b> / ${num(g?.p90)}</td><td>${i.action || i.severity ? '<span class="cf-status-warn" title="rain-fade risk">▲</span>' : ''}${i.series ?
|
|
475
|
+
: `<td>${minute(i.target_at)}</td><td>${esc(linkLabel(i))}</td><td class="cf-num">${num(g?.p10)} / <b>${num(g?.p50)}</b> / ${num(g?.p90)}</td><td>${i.action || i.severity ? '<span class="cf-status-warn" title="rain-fade risk">▲</span>' : ''}${i.series ? changes(i.series) : elevationOf(i) != null ? `${Math.round(elevationOf(i))}°` : ''}</td>`;
|
|
471
476
|
return `<tr data-id="${esc(i.entity.id)}" class="${i.entity.id === selected ? 'cf-sel' : ''}">${cells}</tr>`;
|
|
472
477
|
})
|
|
473
478
|
.join('');
|
|
@@ -481,7 +486,7 @@ export const VIEWS = {
|
|
|
481
486
|
const x = item.explain || {};
|
|
482
487
|
const laneRows = Object.entries(x)
|
|
483
488
|
.filter(([, l]) => shown(l?.value) != null)
|
|
484
|
-
.map(([column, l]) => `<tr><td>${esc(column)}</td><td class="cf-num">${num(shown(l.value))} ${esc(l.unit ?? '')}</td><td class="cf-src" ${tip(l.source ?? '')}>${esc(sourceLabel(l.source))}</td></tr>`)
|
|
489
|
+
.map(([column, l]) => `<tr><td>${esc(column)}</td><td class="cf-num">${SHARES.includes(l.unit) ? pct(shown(l.value)) : `${num(shown(l.value))} ${esc(l.unit ?? '')}`}</td><td class="cf-src" ${tip(l.source ?? '')}>${esc(sourceLabel(l.source))}</td></tr>`)
|
|
485
490
|
.join('');
|
|
486
491
|
const g = run.kind === 'rfi-watch' ? null : gbOf(item);
|
|
487
492
|
const plan = item.series?.length ? `<h4>Plan over the pass</h4>${stepChart(item.series)}` : '';
|
|
@@ -579,6 +584,16 @@ function categoryOf(kind) {
|
|
|
579
584
|
return CATEGORIES.find((c) => c.kinds.includes(kind))?.key ?? 'passes';
|
|
580
585
|
}
|
|
581
586
|
|
|
587
|
+
const KINDS = CATEGORIES.flatMap((c) => c.kinds);
|
|
588
|
+
const rank = (w) => (KINDS.includes(w.kind) ? KINDS.indexOf(w.kind) : KINDS.length);
|
|
589
|
+
|
|
590
|
+
/** The workflow a category (else the whole view) opens on: by kind in CATEGORIES order, so Passes
|
|
591
|
+
* opens on pass yield before a MODCOD plan, then in index order. */
|
|
592
|
+
export function firstWorkflow(workflows, category) {
|
|
593
|
+
const pool = category ? workflows.filter((w) => categoryOf(w.kind) === category) : workflows;
|
|
594
|
+
return [...pool].sort((a, b) => rank(a) - rank(b))[0] ?? null;
|
|
595
|
+
}
|
|
596
|
+
|
|
582
597
|
export function mountForecast(element, { load, refreshMs = REFRESH_MS, theme = 'light' }) {
|
|
583
598
|
const state = { workflows: [], category: null, workflow: null, run: null, selected: null, error: null, loaded: false };
|
|
584
599
|
element.innerHTML = '';
|
|
@@ -596,7 +611,7 @@ export function mountForecast(element, { load, refreshMs = REFRESH_MS, theme = '
|
|
|
596
611
|
const index = await load('index.json');
|
|
597
612
|
state.workflows = index.workflows || [];
|
|
598
613
|
if (!state.workflow || !state.workflows.some((w) => w.workflow === state.workflow)) {
|
|
599
|
-
const first =
|
|
614
|
+
const first = firstWorkflow(state.workflows);
|
|
600
615
|
state.workflow = first?.workflow ?? null;
|
|
601
616
|
state.category = first ? categoryOf(first.kind) : null;
|
|
602
617
|
}
|
|
@@ -646,7 +661,7 @@ export function mountForecast(element, { load, refreshMs = REFRESH_MS, theme = '
|
|
|
646
661
|
const cat = e.target.closest('[data-category]');
|
|
647
662
|
if (cat) {
|
|
648
663
|
state.category = cat.dataset.category;
|
|
649
|
-
const first = state.workflows
|
|
664
|
+
const first = firstWorkflow(state.workflows, state.category);
|
|
650
665
|
state.workflow = first?.workflow ?? null;
|
|
651
666
|
state.selected = null;
|
|
652
667
|
return void refresh();
|