openc3-cosmos-constellation 0.8.2 → 0.8.5
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 +34 -10
- data/microservices/BRIDGE/constellation_space/results.py +135 -24
- data/targets/CONSTELLATION/cmd_tlm/tlm.txt +16 -8
- data/targets/CONSTELLATION/screens/forecast.txt +6 -3
- data/tools/constellationforecast/forecast-view.js +75 -27
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53b51a98ca67f44b6357a6a33df8571bc2f48b032ed3c6133840f9c7b7a534ca
|
|
4
|
+
data.tar.gz: 5a98a9243f1f4379ccc6e998b7d5622fa5efbea3b08a9096cc5e63af86425453
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3aa955fc123b67ee2bdbe48f734eeab548fc7084079ca3c88dda63ae0fdf9f3b2a6c4960dcf58c3e42514c34d07c801ca203f1070c0de8542573c5cd7ed852ea
|
|
7
|
+
data.tar.gz: 51a24b7d342d1519b342b3cd1b434ddad8e8728e42a920f3ae9e0c130c716c1d9089acb1e5b8a8398360fb3299ec6d790353d68e5117974d45c3d546f6aed990
|
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.5
|
|
2
|
+
# (or ./openc3.sh cli rake build VERSION=0.8.5 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.5') 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)
|
|
@@ -8,7 +8,8 @@ target's packets (targets/CONSTELLATION/cmd_tlm/tlm.txt):
|
|
|
8
8
|
|
|
9
9
|
NEXT_PASS the next predicted pass and its expected GB (p10/p50/p90)
|
|
10
10
|
NEXT_24H passes and expected GB over the next 24 hours
|
|
11
|
-
SWAP the soonest rain-fade swap to decide,
|
|
11
|
+
SWAP the soonest rain-fade swap to decide, as advice (add a backup pass or move to it),
|
|
12
|
+
its backup's AOS, LOS and GB, the gain, and minutes left (limits go yellow, then red)
|
|
12
13
|
CAPACITY one day's capacity across the antennas, and the tightest
|
|
13
14
|
MODCOD the next pass's MODCOD plan
|
|
14
15
|
RUN the latest workflow run received, of any kind
|
|
@@ -38,7 +39,7 @@ from typing import Any
|
|
|
38
39
|
|
|
39
40
|
from constellation_space import results
|
|
40
41
|
|
|
41
|
-
VERSION = "0.8.
|
|
42
|
+
VERSION = "0.8.5"
|
|
42
43
|
TARGET = "CONSTELLATION"
|
|
43
44
|
POLL_S = int(os.environ.get("POLL_SECONDS", "15"))
|
|
44
45
|
# COSMOS shows a packet stale 30 s after its last value: re-inject every poll so a quiet feed
|
|
@@ -70,6 +71,8 @@ STRING_BYTES = {
|
|
|
70
71
|
"LOS": 32,
|
|
71
72
|
"BACKUP_ANTENNA": 64,
|
|
72
73
|
"BACKUP_AOS": 32,
|
|
74
|
+
"BACKUP_LOS": 32,
|
|
75
|
+
"ADVICE": 256,
|
|
73
76
|
"DEADLINE": 32,
|
|
74
77
|
"STATUS": 16,
|
|
75
78
|
"DAY": 16,
|
|
@@ -188,6 +191,11 @@ def _minute(iso: str | None) -> str:
|
|
|
188
191
|
return f"{iso[:16].replace('T', ' ')}Z" if iso else ""
|
|
189
192
|
|
|
190
193
|
|
|
194
|
+
def _number(value: Any) -> float:
|
|
195
|
+
"""A number for a FLOAT item; 0 for none, as the item cannot be empty."""
|
|
196
|
+
return float(value) if isinstance(value, int | float) and not isinstance(value, bool) else 0.0
|
|
197
|
+
|
|
198
|
+
|
|
191
199
|
|
|
192
200
|
|
|
193
201
|
|
|
@@ -223,7 +231,7 @@ def swap_items(items: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
|
223
231
|
|
|
224
232
|
|
|
225
233
|
def held_until(item: dict[str, Any]) -> str:
|
|
226
|
-
"""When a held action can no longer be approved, as the API's expires_at() has it: its
|
|
234
|
+
"""When a held action can no longer be approved, as the API's expires_at() has it: its decide-by
|
|
227
235
|
deadline, else when its pass starts, or a link's span ends. The API sends a held item without
|
|
228
236
|
its action, so mostly the latter."""
|
|
229
237
|
end = item["until"] if (item.get("entity") or {}).get("type") == "link" else item["target_at"]
|
|
@@ -280,6 +288,10 @@ NO_SWAP: dict[str, Any] = {
|
|
|
280
288
|
"STATUS": "NONE",
|
|
281
289
|
"APPROVED": 0,
|
|
282
290
|
"PENDING": 0,
|
|
291
|
+
"ADVICE": "NONE",
|
|
292
|
+
"BACKUP_LOS": "",
|
|
293
|
+
"BACKUP_GB": 0.0,
|
|
294
|
+
"GAIN_GB": 0.0,
|
|
283
295
|
}
|
|
284
296
|
|
|
285
297
|
|
|
@@ -321,9 +333,10 @@ def modcod_plans(items: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
|
321
333
|
|
|
322
334
|
def modcod_packet(items: list[dict[str, Any]], now: datetime) -> dict[str, Any] | None:
|
|
323
335
|
"""MODCOD: the next pass's MODCOD plan, its changes and its lowest SINR at a change (the series
|
|
324
|
-
holds only the changes).
|
|
336
|
+
holds only the changes). The next AOS, as NEXT_PASS has it: a pass under way is not next.
|
|
337
|
+
None without a plan ahead."""
|
|
325
338
|
plans = sorted(
|
|
326
|
-
(p for p in modcod_plans(items) if datetime.fromisoformat(p["
|
|
339
|
+
(p for p in modcod_plans(items) if datetime.fromisoformat(p["target_at"]) > now),
|
|
327
340
|
key=lambda p: p["target_at"],
|
|
328
341
|
)
|
|
329
342
|
if not plans:
|
|
@@ -403,6 +416,10 @@ def packets(
|
|
|
403
416
|
"STATUS": "APPROVED" if results.action_state(swap) == "approved" else "ADVISED",
|
|
404
417
|
"APPROVED": sum(results.action_state(s) == "approved" for s in open_swaps),
|
|
405
418
|
"PENDING": pending,
|
|
419
|
+
"ADVICE": results.advice(swap),
|
|
420
|
+
"BACKUP_LOS": _minute(action.get("to_until")),
|
|
421
|
+
"BACKUP_GB": _number(action.get("to_gb")),
|
|
422
|
+
"GAIN_GB": _number(action.get("gain_gb")),
|
|
406
423
|
}
|
|
407
424
|
return out
|
|
408
425
|
|
|
@@ -506,9 +523,12 @@ def check_in(consumer: str) -> bool:
|
|
|
506
523
|
return True
|
|
507
524
|
|
|
508
525
|
|
|
509
|
-
def report(
|
|
526
|
+
def report(
|
|
527
|
+
consumer: str, cursor: str, applied: dict[str, int], outcomes: list[dict[str, str]]
|
|
528
|
+
) -> None:
|
|
510
529
|
try:
|
|
511
|
-
|
|
530
|
+
target = f"OpenC3 COSMOS target {TARGET}"
|
|
531
|
+
results.report(call, consumer, cursor, applied, target, outcomes, log)
|
|
512
532
|
except Exception as exc:
|
|
513
533
|
log(f"could not report ({exc})", warn=True)
|
|
514
534
|
|
|
@@ -628,6 +648,7 @@ def main() -> None:
|
|
|
628
648
|
keep(consumer, cursor, forecast)
|
|
629
649
|
continue
|
|
630
650
|
applied = {"parameters": 0, "forecasts": 0}
|
|
651
|
+
outcomes: list[dict[str, str]] = []
|
|
631
652
|
for resource, items in parts:
|
|
632
653
|
system = resource.get("constellation.system")
|
|
633
654
|
if system != "cosmos":
|
|
@@ -644,8 +665,11 @@ def main() -> None:
|
|
|
644
665
|
applied["malformed"] = applied.get("malformed", 0) + bad
|
|
645
666
|
items = good
|
|
646
667
|
applied["forecasts"] += forecast.take(resource, items)
|
|
647
|
-
# Approved swaps it shows as
|
|
648
|
-
|
|
668
|
+
# Approved swaps it shows as approved advice: the platform shows them acted on.
|
|
669
|
+
shown = f"shown in the {TARGET} SWAP packet"
|
|
670
|
+
if acted := results.first_acted(
|
|
671
|
+
swap_items(items), forecast.acted, outcomes, shown
|
|
672
|
+
):
|
|
649
673
|
applied["acted"] = applied.get("acted", 0) + acted
|
|
650
674
|
widget = output_of(resource).get("widget") or {}
|
|
651
675
|
if widget.get("on"):
|
|
@@ -655,7 +679,7 @@ def main() -> None:
|
|
|
655
679
|
refreshed = time.time()
|
|
656
680
|
# Only a run applied moves the cursor: one that failed part-way is retried.
|
|
657
681
|
cursor = entry["cursor"]
|
|
658
|
-
report(consumer, cursor, applied)
|
|
682
|
+
report(consumer, cursor, applied, outcomes)
|
|
659
683
|
keep(consumer, cursor, forecast)
|
|
660
684
|
log(f"injected {applied['parameters']} packets, {cursor}")
|
|
661
685
|
if page["entries"]:
|
|
@@ -104,7 +104,7 @@ def http(
|
|
|
104
104
|
|
|
105
105
|
def action_state(item: dict[str, Any]) -> str | None:
|
|
106
106
|
"""What an item's action is to a bridge. "advice": suggested, never an instruction.
|
|
107
|
-
"approved": a person approved it in Constellation,
|
|
107
|
+
"approved": a person approved it in Constellation, advice to carry out. "pending":
|
|
108
108
|
held for approval; the action itself is not sent, only action_status. "rejected": decided
|
|
109
109
|
against; the original stands. None: the item has no action. Any status other than approved
|
|
110
110
|
or rejected counts as held, so an item a bridge cannot read is never taken for a plain
|
|
@@ -152,7 +152,7 @@ def parse_time(value: Any) -> datetime | None:
|
|
|
152
152
|
|
|
153
153
|
def acted_until(item: dict[str, Any]) -> str:
|
|
154
154
|
"""When an acted key may be forgotten: the latest of the item's time, its end (a pass's end),
|
|
155
|
-
its action's
|
|
155
|
+
its action's deadline and now, plus KEEP_ACTED, so a key is never dropped as soon as it
|
|
156
156
|
is written. "" (kept for good) when none of the item's is a time."""
|
|
157
157
|
action = item.get("action") or {}
|
|
158
158
|
times = [
|
|
@@ -164,21 +164,110 @@ def acted_until(item: dict[str, Any]) -> str:
|
|
|
164
164
|
return (max(*known, now()) + KEEP_ACTED).astimezone(timezone.utc).isoformat(timespec="seconds")
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
def first_acted(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
def first_acted(
|
|
168
|
+
items: list[dict[str, Any]],
|
|
169
|
+
acted: dict[str, str],
|
|
170
|
+
outcomes: list[dict[str, str]] | None = None,
|
|
171
|
+
how: str = "",
|
|
172
|
+
) -> int:
|
|
173
|
+
"""How many of these items are approved actions still open (before their deadline) carried
|
|
174
|
+
out for the first time. A bridge that enforces or shows approvals on every run, rather than
|
|
175
|
+
acting once, counts each decision (action_key) once: `acted` maps each counted to when it may
|
|
176
|
+
be forgotten (acted_until), kept in the bridge's state, and loses keys long over. Each one
|
|
177
|
+
counted goes in `outcomes` as acted (`how` says how), and an approval first seen past its
|
|
178
|
+
deadline as refused, each once (outcome())."""
|
|
172
179
|
_drop_over(acted)
|
|
173
180
|
first = 0
|
|
174
181
|
for item in items:
|
|
175
182
|
key = action_key(item)
|
|
176
|
-
if action_state(item)
|
|
177
|
-
|
|
183
|
+
if action_state(item) != "approved" or key in acted:
|
|
184
|
+
continue
|
|
185
|
+
acted[key] = acted_until(item)
|
|
186
|
+
if past_deadline(item):
|
|
187
|
+
said = outcome(item, "refused", too_late(item))
|
|
188
|
+
else:
|
|
178
189
|
first += 1
|
|
190
|
+
said = outcome(item, "acted", how)
|
|
191
|
+
if outcomes is not None and said:
|
|
192
|
+
outcomes.append(said)
|
|
179
193
|
return first
|
|
180
194
|
|
|
181
195
|
|
|
196
|
+
def outcome(item: dict[str, Any], result: str, reason: str = "") -> dict[str, str] | None:
|
|
197
|
+
"""What mission control did with an approved action, for the delivery report's `actions`:
|
|
198
|
+
acted or refused, and why. None for an item that does not name its action and decision (an
|
|
199
|
+
API from before outcomes): the API could not match it."""
|
|
200
|
+
if not (item.get("action_id") and item.get("decision_id")):
|
|
201
|
+
return None
|
|
202
|
+
return {
|
|
203
|
+
"action_id": str(item["action_id"]),
|
|
204
|
+
"decision_id": str(item["decision_id"]),
|
|
205
|
+
"outcome": result,
|
|
206
|
+
"reason": reason[:500],
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def too_late(item: dict[str, Any]) -> str:
|
|
211
|
+
"""Why an approval past its deadline was refused."""
|
|
212
|
+
return f"it arrived after its decide-by time, {minute((item.get('action') or {}).get('deadline'))}"
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def minute(value: Any) -> str:
|
|
216
|
+
"""An ISO time to the minute, as the texts write it: 2026-11-05 09:45Z."""
|
|
217
|
+
at = parse_time(value) if value else None
|
|
218
|
+
return at.astimezone(timezone.utc).strftime("%Y-%m-%d %H:%MZ") if at else ""
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
# Why a swap advises its action (the action's `reason`), as a person reads it.
|
|
222
|
+
REASONS = {
|
|
223
|
+
"adds_capacity": "it adds capacity",
|
|
224
|
+
"overlap": "both passes use one radio at once",
|
|
225
|
+
"paid_booking": "releasing the paid booking in time is worth it",
|
|
226
|
+
"original_empty": "this pass delivers about nothing in the rain",
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _gb_text(value: Any) -> str | None:
|
|
231
|
+
return f"{value:.1f} GB" if isinstance(value, int | float) and not isinstance(value, bool) else None
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def advice(item: dict[str, Any]) -> str:
|
|
235
|
+
"""A swap as the advice it is, never a command: add a backup pass (and keep this one) or move
|
|
236
|
+
to the backup, its time and GB, the gain over doing nothing (gain_gb), why, and when to
|
|
237
|
+
decide by. The customer's contact plan is theirs; Constellation books and cancels nothing."""
|
|
238
|
+
action = item.get("action") or {}
|
|
239
|
+
if not action.get("to_antenna_id"):
|
|
240
|
+
return "No backup pass in the window"
|
|
241
|
+
move = action.get("action") == "move"
|
|
242
|
+
text = f"{'Move to the backup' if move else 'Add a backup pass'} on {action['to_antenna_id']}"
|
|
243
|
+
if at := minute(action.get("to_at")):
|
|
244
|
+
text += f" at {at}"
|
|
245
|
+
if until := minute(action.get("to_until")):
|
|
246
|
+
text += f" to {until[-6:]}"
|
|
247
|
+
if gb := _gb_text(action.get("to_gb")):
|
|
248
|
+
text += f" ({gb})"
|
|
249
|
+
text += " instead of this one" if move else " and keep this one"
|
|
250
|
+
if gain := _gb_text(action.get("gain_gb")):
|
|
251
|
+
text += f", +{gain}"
|
|
252
|
+
if why := REASONS.get(action.get("reason") or ""):
|
|
253
|
+
text += f": {why}"
|
|
254
|
+
if deadline := minute(action.get("deadline")):
|
|
255
|
+
text += f"; decide by {deadline}"
|
|
256
|
+
return text
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def loss(item: dict[str, Any]) -> str:
|
|
260
|
+
"""What rain costs the pass, as a person reads it: the note's own sentence ("Rain costs 60%
|
|
261
|
+
of its dry 0.6 GB"), which only the API can say as it alone knows the dry yield, else the GB
|
|
262
|
+
the pass is expected to carry in the rain (p50). Never a p10, which equals the p50 in a
|
|
263
|
+
forecast with no spread."""
|
|
264
|
+
note = item.get("note") or ""
|
|
265
|
+
if note.startswith("Rain costs"):
|
|
266
|
+
return note.split(". ", 1)[0]
|
|
267
|
+
gb = expected_gb(item)
|
|
268
|
+
return f"{gb['p50']:.1f} GB expected in the rain" if gb else ""
|
|
269
|
+
|
|
270
|
+
|
|
182
271
|
def _drop_over(keys: dict[str, str]) -> bool:
|
|
183
272
|
"""Drops the keys whose time to be forgotten has passed; whether any was."""
|
|
184
273
|
cutoff = now()
|
|
@@ -189,7 +278,7 @@ def _drop_over(keys: dict[str, str]) -> bool:
|
|
|
189
278
|
|
|
190
279
|
|
|
191
280
|
def past_deadline(item: dict[str, Any]) -> bool:
|
|
192
|
-
"""Whether the item's action is past its
|
|
281
|
+
"""Whether the item's action is past its deadline (decide-by): closed, never to be carried out."""
|
|
193
282
|
deadline = parse_time((item.get("action") or {}).get("deadline"))
|
|
194
283
|
return deadline is not None and deadline <= now()
|
|
195
284
|
|
|
@@ -449,22 +538,44 @@ def start_cursor(call: Callable[..., Any], consumer: str) -> str:
|
|
|
449
538
|
return page["next"]
|
|
450
539
|
|
|
451
540
|
|
|
541
|
+
# The most action outcomes the API takes in one delivery report.
|
|
542
|
+
MAX_OUTCOMES = 200
|
|
543
|
+
|
|
544
|
+
|
|
452
545
|
def report(
|
|
453
|
-
call: Callable[..., Any],
|
|
546
|
+
call: Callable[..., Any],
|
|
547
|
+
consumer: str,
|
|
548
|
+
cursor: str,
|
|
549
|
+
applied: dict[str, int],
|
|
550
|
+
target: str,
|
|
551
|
+
actions: list[dict[str, str]] | None = None,
|
|
552
|
+
log: Callable[[str], None] = print,
|
|
454
553
|
) -> None:
|
|
455
|
-
"""Tells Constellation what the run at `cursor` became in the system, shown in Constellation
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
554
|
+
"""Tells Constellation what the run at `cursor` became in the system, shown in Constellation,
|
|
555
|
+
and what became of each approved action in it (`actions`, outcome()); raises when
|
|
556
|
+
Constellation does not take it. An API from before outcomes refuses `actions` (422), and one
|
|
557
|
+
whose decision has moved on refuses the whole report (409 unknown_decision): either way the
|
|
558
|
+
report is sent again without them, so the delivery is still recorded."""
|
|
559
|
+
body = {
|
|
560
|
+
"consumer": consumer,
|
|
561
|
+
"run_id": cursor.split("#", 1)[1],
|
|
562
|
+
"cursor": cursor,
|
|
563
|
+
"applied": applied,
|
|
564
|
+
"target": target,
|
|
565
|
+
}
|
|
566
|
+
if not actions:
|
|
567
|
+
call("POST", "/predictions/feed/deliveries", body)
|
|
568
|
+
return
|
|
569
|
+
try:
|
|
570
|
+
call("POST", "/predictions/feed/deliveries", {**body, "actions": actions[:MAX_OUTCOMES]})
|
|
571
|
+
except Exception as exc:
|
|
572
|
+
if getattr(exc, "code", None) not in (409, 422):
|
|
573
|
+
raise
|
|
574
|
+
log(
|
|
575
|
+
f"Constellation did not take the outcomes of {len(actions)} approved action(s) of"
|
|
576
|
+
f" {cursor} (HTTP {exc.code}); reported the delivery without them"
|
|
577
|
+
)
|
|
578
|
+
call("POST", "/predictions/feed/deliveries", body)
|
|
468
579
|
|
|
469
580
|
|
|
470
581
|
def kind(items: list[dict[str, Any]]) -> str:
|
|
@@ -34,22 +34,30 @@ TELEMETRY CONSTELLATION SWAP BIG_ENDIAN "Forecast: the soonest open rain-fade sw
|
|
|
34
34
|
APPEND_ITEM SATELLITE 512 STRING "Satellite id"
|
|
35
35
|
APPEND_ITEM ANTENNA 512 STRING "Antenna at risk"
|
|
36
36
|
APPEND_ITEM AOS 256 STRING "Predicted AOS of the pass at risk, UTC"
|
|
37
|
-
APPEND_ITEM KEEPS_GB_P10 32 FLOAT "
|
|
37
|
+
APPEND_ITEM KEEPS_GB_P10 32 FLOAT "Deprecated: the p10, equal to EXPECTED_GB_P50 in a forecast with no spread. Read EXPECTED_GB_P50"
|
|
38
38
|
UNITS Gigabytes GB
|
|
39
39
|
FORMAT_STRING "%.3f"
|
|
40
|
-
APPEND_ITEM EXPECTED_GB_P50 32 FLOAT "GB the pass
|
|
40
|
+
APPEND_ITEM EXPECTED_GB_P50 32 FLOAT "GB the pass is expected to carry in the rain (p50)"
|
|
41
41
|
UNITS Gigabytes GB
|
|
42
42
|
FORMAT_STRING "%.3f"
|
|
43
|
-
APPEND_ITEM BACKUP_ANTENNA 512 STRING "Antenna
|
|
43
|
+
APPEND_ITEM BACKUP_ANTENNA 512 STRING "Antenna of the backup pass advised, or NONE"
|
|
44
44
|
APPEND_ITEM BACKUP_AOS 256 STRING "Backup pass AOS, UTC"
|
|
45
|
-
APPEND_ITEM DEADLINE 256 STRING "
|
|
46
|
-
APPEND_ITEM MINUTES_TO_DEADLINE 32 FLOAT "Minutes left to decide (99999 when no swap is open)"
|
|
45
|
+
APPEND_ITEM DEADLINE 256 STRING "Decide by, UTC"
|
|
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
|
|
50
|
-
APPEND_ITEM STATUS 128 STRING "The swap shown: ADVISED, APPROVED (approved in Constellation
|
|
50
|
+
APPEND_ITEM STATUS 128 STRING "The swap shown: ADVISED, APPROVED (advice approved in Constellation) or NONE"
|
|
51
51
|
APPEND_ITEM APPROVED 32 UINT "Open swaps approved in Constellation"
|
|
52
52
|
APPEND_ITEM PENDING 32 UINT "Swaps held for approval in Constellation, deadline ahead"
|
|
53
|
+
APPEND_ITEM ADVICE 2048 STRING "The advice in words: add a backup pass (keep this one) or move to the backup, its gain and why"
|
|
54
|
+
APPEND_ITEM BACKUP_LOS 256 STRING "Backup pass LOS, UTC"
|
|
55
|
+
APPEND_ITEM BACKUP_GB 32 FLOAT "GB the backup pass is expected to carry (p50)"
|
|
56
|
+
UNITS Gigabytes GB
|
|
57
|
+
FORMAT_STRING "%.3f"
|
|
58
|
+
APPEND_ITEM GAIN_GB 32 FLOAT "GB the advice adds over doing nothing (p50)"
|
|
59
|
+
UNITS Gigabytes GB
|
|
60
|
+
FORMAT_STRING "%.3f"
|
|
53
61
|
|
|
54
62
|
TELEMETRY CONSTELLATION CAPACITY BIG_ENDIAN "Forecast: one day's capacity across the antennas, and the tightest"
|
|
55
63
|
ALLOW_SHORT
|
|
@@ -75,13 +83,13 @@ TELEMETRY CONSTELLATION MODCOD BIG_ENDIAN "Forecast: the next pass's MODCOD plan
|
|
|
75
83
|
APPEND_ITEM SATELLITE 512 STRING "Satellite id"
|
|
76
84
|
APPEND_ITEM ANTENNA 512 STRING "Antenna id"
|
|
77
85
|
APPEND_ITEM AOS 256 STRING "Predicted AOS, UTC"
|
|
78
|
-
APPEND_ITEM CHANGES 32 UINT "MODCOD changes over the pass"
|
|
86
|
+
APPEND_ITEM CHANGES 32 UINT "MODCOD changes over the pass, after the one at AOS"
|
|
79
87
|
APPEND_ITEM FIRST 256 STRING "MODCOD at AOS"
|
|
80
88
|
APPEND_ITEM LAST 256 STRING "MODCOD at LOS"
|
|
81
89
|
APPEND_ITEM MIN_SINR_DB 32 FLOAT "Lowest planned SINR (p50) at a MODCOD change"
|
|
82
90
|
UNITS Decibels dB
|
|
83
91
|
FORMAT_STRING "%.2f"
|
|
84
|
-
APPEND_ITEM PLANNED_PASSES 32 UINT "Passes with a plan
|
|
92
|
+
APPEND_ITEM PLANNED_PASSES 32 UINT "Passes ahead with a plan"
|
|
85
93
|
|
|
86
94
|
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
95
|
ALLOW_SHORT
|
|
@@ -34,11 +34,14 @@ HORIZONTAL
|
|
|
34
34
|
LABELVALUEDESC CONSTELLATION SWAP SATELLITE "Satellite" CONVERTED 16
|
|
35
35
|
LABELVALUEDESC CONSTELLATION SWAP ANTENNA "Antenna" CONVERTED 16
|
|
36
36
|
LABELVALUEDESC CONSTELLATION SWAP AOS "AOS" CONVERTED 16
|
|
37
|
-
LABELVALUEDESC CONSTELLATION SWAP DEADLINE "
|
|
37
|
+
LABELVALUEDESC CONSTELLATION SWAP DEADLINE "Decide by" CONVERTED 16
|
|
38
|
+
LABELVALUEDESC CONSTELLATION SWAP EXPECTED_GB_P50 "GB expected" WITH_UNITS 16
|
|
39
|
+
LABELVALUEDESC CONSTELLATION SWAP ADVICE "Advice" CONVERTED 16
|
|
38
40
|
LABELVALUEDESC CONSTELLATION SWAP BACKUP_ANTENNA "Backup" CONVERTED 16
|
|
39
41
|
LABELVALUEDESC CONSTELLATION SWAP BACKUP_AOS "Backup AOS" CONVERTED 16
|
|
40
|
-
LABELVALUEDESC CONSTELLATION SWAP
|
|
41
|
-
LABELVALUEDESC CONSTELLATION SWAP
|
|
42
|
+
LABELVALUEDESC CONSTELLATION SWAP BACKUP_LOS "Backup LOS" CONVERTED 16
|
|
43
|
+
LABELVALUEDESC CONSTELLATION SWAP BACKUP_GB "Backup GB" WITH_UNITS 16
|
|
44
|
+
LABELVALUEDESC CONSTELLATION SWAP GAIN_GB "Gain" WITH_UNITS 16
|
|
42
45
|
LABELVALUEDESC CONSTELLATION SWAP APPROVED "Approved" CONVERTED 16
|
|
43
46
|
LABELVALUEDESC CONSTELLATION SWAP PENDING "Pending" CONVERTED 16
|
|
44
47
|
END
|
|
@@ -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('');
|
|
@@ -170,7 +173,7 @@ function dumbbell(rows, { unit = 'GB' } = {}) {
|
|
|
170
173
|
const h = pad.t + rows.length * rowH;
|
|
171
174
|
const max = Math.max(...rows.map((r) => r.b), 0.001);
|
|
172
175
|
const x = (v) => pad.l + (v / max) * (W - pad.l - pad.r);
|
|
173
|
-
return `<svg class="cf-chart" viewBox="0 0 ${W} ${h}" role="img" aria-label="
|
|
176
|
+
return `<svg class="cf-chart" viewBox="0 0 ${W} ${h}" role="img" aria-label="GB per pass, without and with the advice">${rows
|
|
174
177
|
.map((r, i) => {
|
|
175
178
|
const y = pad.t + i * rowH + rowH / 2;
|
|
176
179
|
return `<g ${tip(r.tip)}><text class="cf-label" x="${pad.l - 8}" y="${y + 4}" text-anchor="end">${esc(r.label)}</text><line class="cf-whisker" x1="${x(r.a)}" x2="${x(r.b)}" y1="${y}" y2="${y}"/><circle class="cf-dot-warn" cx="${x(r.a)}" cy="${y}" r="5"/><circle class="cf-dot" cx="${x(r.b)}" cy="${y}" r="5"/></g>`;
|
|
@@ -251,7 +254,7 @@ const tile = (label, value, hint) => `<div class="cf-tile"><div class="cf-tile-v
|
|
|
251
254
|
const section = (title, body, note) => `<section class="cf-section"><h3>${esc(title)}</h3>${note ? `<p class="cf-note">${esc(note)}</p>` : ''}${body}</section>`;
|
|
252
255
|
|
|
253
256
|
/** What an item's action is, as the bridges read it (constellation_space.results.action_state):
|
|
254
|
-
* 'advice' (suggested), 'approved' (approved in Constellation:
|
|
257
|
+
* 'advice' (suggested), 'approved' (approved in Constellation: advice to act on), 'pending' (held
|
|
255
258
|
* for approval; its action is not sent), 'rejected', or null with no action. A status the view
|
|
256
259
|
* does not know is held, never a plain forecast. */
|
|
257
260
|
export function actionState(item) {
|
|
@@ -264,6 +267,40 @@ 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
|
+
// Why a swap advises its action (the action's reason), as constellation_space.results.REASONS.
|
|
271
|
+
const REASONS = {
|
|
272
|
+
adds_capacity: 'it adds capacity',
|
|
273
|
+
overlap: 'both passes use one radio at once',
|
|
274
|
+
paid_booking: 'releasing the paid booking in time is worth it',
|
|
275
|
+
original_empty: 'this pass delivers about nothing in the rain',
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/** A swap as the advice it is, as constellation_space.results.advice words it: add a backup
|
|
279
|
+
* pass (keep this one) or move to the backup, its time and GB, the gain (gain_gb), and why.
|
|
280
|
+
* Never a cancel: Constellation books and cancels nothing. */
|
|
281
|
+
export function advice(item) {
|
|
282
|
+
const a = item.action || {};
|
|
283
|
+
if (!a.to_antenna_id) return 'No backup pass in the window';
|
|
284
|
+
const move = a.action === 'move';
|
|
285
|
+
let text = `${move ? 'Move to the backup' : 'Add a backup pass'} on ${shortAntenna(a.to_antenna_id)}`;
|
|
286
|
+
if (a.to_at) text += ` at ${a.to_at.slice(0, 16).replace('T', ' ')}Z${a.to_until ? ` to ${a.to_until.slice(11, 16)}Z` : ''}`;
|
|
287
|
+
if (typeof a.to_gb === 'number') text += ` (${a.to_gb.toFixed(1)} GB)`;
|
|
288
|
+
text += move ? ' instead of this one' : ' and keep this one';
|
|
289
|
+
if (typeof a.gain_gb === 'number') text += `, +${a.gain_gb.toFixed(1)} GB`;
|
|
290
|
+
if (REASONS[a.reason]) text += `: ${REASONS[a.reason]}`;
|
|
291
|
+
return text;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** What rain costs a pass, as constellation_space.results.loss says it: the note's own sentence,
|
|
295
|
+
* else the GB expected in the rain (p50), never a p10 that equals it. */
|
|
296
|
+
export function loss(item) {
|
|
297
|
+
const note = item.note || '';
|
|
298
|
+
if (note.startsWith('Rain costs')) return note.split('. ')[0];
|
|
299
|
+
return `${num(gbOf(item)?.p50)} GB expected in the rain`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// A probability or share column reads as a percent, as the lock-loss risk does.
|
|
303
|
+
const SHARES = ['probability', 'share'];
|
|
267
304
|
// rfi-watch items are links whose value is RFI in dB (p10/p50/p90) with a lock-loss risk (a
|
|
268
305
|
// share), and whose action is a reroute with no deadline: never GB, never a swap.
|
|
269
306
|
const pct = (v) => (typeof v === 'number' ? `${Math.round(v * 100)}%` : num(v));
|
|
@@ -338,11 +375,11 @@ export const VIEWS = {
|
|
|
338
375
|
const swaps = items.filter(actionable).sort((a, b) => a.action.deadline.localeCompare(b.action.deadline));
|
|
339
376
|
const approved = swaps.filter((i) => actionState(i) === 'approved').length;
|
|
340
377
|
const held = items.filter((i) => actionState(i) === 'pending').length;
|
|
341
|
-
const
|
|
378
|
+
const gain = swaps.reduce((s, i) => s + (typeof i.action.gain_gb === 'number' ? i.action.gain_gb : 0), 0);
|
|
342
379
|
const soonest = swaps.find((i) => Date.parse(i.action.deadline) > Date.now());
|
|
343
380
|
const booked = swaps.filter((i) => i.action.to).length;
|
|
344
381
|
const hint = approved || held ? `${approved} approved · ${held} awaiting approval` : `${booked} with a better backup`;
|
|
345
|
-
return `<div class="cf-tiles">${tile('swaps to decide', swaps.length - approved, hint)}${tile('GB
|
|
382
|
+
return `<div class="cf-tiles">${tile('swaps to decide', swaps.length - approved, hint)}${tile('GB the advice adds', big(gain), 'over doing nothing (p50), summed')}${tile('soonest decision', soonest ? until(soonest.action.deadline) : '—', soonest ? `decide by ${minute(soonest.action.deadline)}` : '')}${tile('workflow version', `v${run.workflow_version}`)}</div>`;
|
|
346
383
|
}
|
|
347
384
|
const day = items.filter((i) => Date.parse(i.target_at) < Date.now() + 86400e3);
|
|
348
385
|
const p50 = day.reduce((s, i) => s + (gbOf(i)?.p50 ?? 0), 0);
|
|
@@ -376,16 +413,19 @@ export const VIEWS = {
|
|
|
376
413
|
return section('Passes at weather risk', `<p class="cf-empty">${none}</p>`);
|
|
377
414
|
}
|
|
378
415
|
return section(
|
|
379
|
-
'What each at-risk pass
|
|
416
|
+
'What the advice adds to each at-risk pass',
|
|
380
417
|
dumbbell(
|
|
381
|
-
risky.map((i) =>
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
418
|
+
risky.map((i) => {
|
|
419
|
+
const gain = typeof i.action.gain_gb === 'number' ? i.action.gain_gb : 0;
|
|
420
|
+
return {
|
|
421
|
+
label: `${i.entity.satellite_id} @ ${stationTag(i.entity.antenna_id)}`,
|
|
422
|
+
a: gbOf(i).p50,
|
|
423
|
+
b: gbOf(i).p50 + gain,
|
|
424
|
+
tip: `${linkLabel(i)} at ${minute(i.target_at)}: ${num(gbOf(i).p50)} GB expected in the rain, +${num(gain)} GB with the advice`,
|
|
425
|
+
};
|
|
426
|
+
}),
|
|
387
427
|
),
|
|
388
|
-
'Amber is the
|
|
428
|
+
'Amber is the GB expected in the rain (p50); dark adds the gain the advice brings over doing nothing.',
|
|
389
429
|
);
|
|
390
430
|
}
|
|
391
431
|
if (run.kind === 'audit-ledger') {
|
|
@@ -400,7 +440,7 @@ export const VIEWS = {
|
|
|
400
440
|
const mix = new Map();
|
|
401
441
|
for (const item of items) for (const s of item.series || []) mix.set(s.value.modcod, (mix.get(s.value.modcod) || 0) + 1);
|
|
402
442
|
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.');
|
|
443
|
+
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
444
|
}
|
|
405
445
|
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
446
|
},
|
|
@@ -431,22 +471,20 @@ export const VIEWS = {
|
|
|
431
471
|
.slice(0, 6)
|
|
432
472
|
.map((i) => {
|
|
433
473
|
const a = i.action;
|
|
434
|
-
const g = gbOf(i);
|
|
435
474
|
const approved = actionState(i) === 'approved';
|
|
436
|
-
const
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
return `<div class="cf-card" ${tip(`Decide by ${minute(a.deadline)}`)}><div class="cf-card-head"><span class="cf-status-warn" aria-hidden="true">▲</span><b>${head}</b><span class="cf-chip">${until(a.deadline)}</span></div><div>${esc(linkLabel(i))} at ${minute(i.target_at)} keeps ${num(g.p10)} of ${num(g.p50)} GB if it rains.</div><div class="cf-card-action">${backup}</div><div class="cf-note">${note}</div></div>`;
|
|
475
|
+
const head = approved ? 'Approved advice' : 'Rain-fade risk';
|
|
476
|
+
const note = approved ? `Approved in Constellation. Decide by ${minute(a.deadline)}` : `Decide by ${minute(a.deadline)}`;
|
|
477
|
+
return `<div class="cf-card" ${tip(`Decide by ${minute(a.deadline)}`)}><div class="cf-card-head"><span class="cf-status-warn" aria-hidden="true">▲</span><b>${head}</b><span class="cf-chip">${until(a.deadline)}</span></div><div>${esc(linkLabel(i))} at ${minute(i.target_at)}: ${esc(loss(i))}.</div><div class="cf-card-action">${esc(advice(i))}</div><div class="cf-note">${note}</div></div>`;
|
|
440
478
|
});
|
|
441
479
|
// A pass at risk with no backup comes as advice alone (a warning and its note): nothing to decide.
|
|
442
480
|
const advisories = items
|
|
443
481
|
.filter((i) => actionState(i) === null && i.severity)
|
|
444
482
|
.slice(0, Math.max(0, 6 - cards.length))
|
|
445
|
-
.map((i) => `<div class="cf-card"><div class="cf-card-head"><span class="cf-status-warn" aria-hidden="true">▲</span><b>Rain-fade risk</b></div><div>${esc(linkLabel(i))} at ${minute(i.target_at)}
|
|
483
|
+
.map((i) => `<div class="cf-card"><div class="cf-card-head"><span class="cf-status-warn" aria-hidden="true">▲</span><b>Rain-fade risk</b></div><div>${esc(linkLabel(i))} at ${minute(i.target_at)}: ${esc(loss(i))}.</div><div class="cf-card-action">${esc(i.note || 'No backup pass in the window')}</div></div>`);
|
|
446
484
|
cards.push(...advisories);
|
|
447
485
|
const waiting = held ? ` ${held} awaiting approval in Constellation.` : '';
|
|
448
486
|
const more = (all.length > 6 ? `The ${6} soonest of ${all.length}. Every swap is in Results below.` : 'Approved first, then the soonest decision.') + waiting;
|
|
449
|
-
const title = all.some((i) => actionState(i) === 'approved') ? '
|
|
487
|
+
const title = all.some((i) => actionState(i) === 'approved') ? 'Approved advice and swaps to decide' : 'Swaps to decide';
|
|
450
488
|
if (!cards.length) return section(title, `<p class="cf-empty">No swaps to decide.${waiting}</p>`);
|
|
451
489
|
return section(title, `<div class="cf-cards">${cards.join('')}</div>`, more);
|
|
452
490
|
},
|
|
@@ -467,7 +505,7 @@ export const VIEWS = {
|
|
|
467
505
|
? `<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
506
|
: run.kind === 'antenna-capacity'
|
|
469
507
|
? `<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 ?
|
|
508
|
+
: `<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
509
|
return `<tr data-id="${esc(i.entity.id)}" class="${i.entity.id === selected ? 'cf-sel' : ''}">${cells}</tr>`;
|
|
472
510
|
})
|
|
473
511
|
.join('');
|
|
@@ -481,7 +519,7 @@ export const VIEWS = {
|
|
|
481
519
|
const x = item.explain || {};
|
|
482
520
|
const laneRows = Object.entries(x)
|
|
483
521
|
.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>`)
|
|
522
|
+
.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
523
|
.join('');
|
|
486
524
|
const g = run.kind === 'rfi-watch' ? null : gbOf(item);
|
|
487
525
|
const plan = item.series?.length ? `<h4>Plan over the pass</h4>${stepChart(item.series)}` : '';
|
|
@@ -579,6 +617,16 @@ function categoryOf(kind) {
|
|
|
579
617
|
return CATEGORIES.find((c) => c.kinds.includes(kind))?.key ?? 'passes';
|
|
580
618
|
}
|
|
581
619
|
|
|
620
|
+
const KINDS = CATEGORIES.flatMap((c) => c.kinds);
|
|
621
|
+
const rank = (w) => (KINDS.includes(w.kind) ? KINDS.indexOf(w.kind) : KINDS.length);
|
|
622
|
+
|
|
623
|
+
/** The workflow a category (else the whole view) opens on: by kind in CATEGORIES order, so Passes
|
|
624
|
+
* opens on pass yield before a MODCOD plan, then in index order. */
|
|
625
|
+
export function firstWorkflow(workflows, category) {
|
|
626
|
+
const pool = category ? workflows.filter((w) => categoryOf(w.kind) === category) : workflows;
|
|
627
|
+
return [...pool].sort((a, b) => rank(a) - rank(b))[0] ?? null;
|
|
628
|
+
}
|
|
629
|
+
|
|
582
630
|
export function mountForecast(element, { load, refreshMs = REFRESH_MS, theme = 'light' }) {
|
|
583
631
|
const state = { workflows: [], category: null, workflow: null, run: null, selected: null, error: null, loaded: false };
|
|
584
632
|
element.innerHTML = '';
|
|
@@ -596,7 +644,7 @@ export function mountForecast(element, { load, refreshMs = REFRESH_MS, theme = '
|
|
|
596
644
|
const index = await load('index.json');
|
|
597
645
|
state.workflows = index.workflows || [];
|
|
598
646
|
if (!state.workflow || !state.workflows.some((w) => w.workflow === state.workflow)) {
|
|
599
|
-
const first =
|
|
647
|
+
const first = firstWorkflow(state.workflows);
|
|
600
648
|
state.workflow = first?.workflow ?? null;
|
|
601
649
|
state.category = first ? categoryOf(first.kind) : null;
|
|
602
650
|
}
|
|
@@ -646,7 +694,7 @@ export function mountForecast(element, { load, refreshMs = REFRESH_MS, theme = '
|
|
|
646
694
|
const cat = e.target.closest('[data-category]');
|
|
647
695
|
if (cat) {
|
|
648
696
|
state.category = cat.dataset.category;
|
|
649
|
-
const first = state.workflows
|
|
697
|
+
const first = firstWorkflow(state.workflows, state.category);
|
|
650
698
|
state.workflow = first?.workflow ?? null;
|
|
651
699
|
state.selected = null;
|
|
652
700
|
return void refresh();
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openc3-cosmos-constellation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Constellation Space Corp
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: 'A CONSTELLATION target whose packets a bridge microservice fills from
|
|
14
14
|
the Constellation feed: the next predicted pass, the next 24 hours, the soonest
|