From e3a77e421d5f119f86f404c87d02c04ec8976951 Mon Sep 17 00:00:00 2001 From: serversdown Date: Tue, 3 Nov 2026 19:30:07 -0500 Subject: [PATCH] docs(spec,plan): phase 5 -- the units' own limits, from Instantel's manuals Brian: use the actual unit limits, not what has been used in the past. Trigger 0.005-10 in/s in 0.001 steps (capped by the range), record time 1-90 s (Micromate) or the MiniMate manual's 1 MB table by sample rate (13 s in Histogram Combo), job number 1-9999. The read-back reports any value a unit does not take. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 --- .../plans/2026-11-03-sfm-phase5-settings.md | 26 +++++++++------ .../2026-11-03-sfm-phase5-settings-design.md | 33 +++++++++++++------ 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/docs/superpowers/plans/2026-11-03-sfm-phase5-settings.md b/docs/superpowers/plans/2026-11-03-sfm-phase5-settings.md index c1a0066..e7a27a8 100644 --- a/docs/superpowers/plans/2026-11-03-sfm-phase5-settings.md +++ b/docs/superpowers/plans/2026-11-03-sfm-phase5-settings.md @@ -150,7 +150,7 @@ def test_read_compliance_content_refuses_a_missing_frame(): - Produces (all pure). Each `content` is the 2,090-byte (Series 3) or 2,092-byte (Series 4) block. - `editable_fields(content: bytes, series: int) -> list[dict]`. Each dict has `field`, `label`, `kind` (`"number"`, `"choice"`, `"text"` or `"bool"`) and `value`, plus as relevant `unit`, `min`, `max`, `choices` (a list of `{value, label}`) and `maxlength`. - `field_values(content: bytes, series: int) -> dict[str, Any]`: the same fields, values only. - - `check_changes(content: bytes, series: int, changes: dict) -> dict`: returns the normalised changes, or raises `SettingsValueError(ValueError)` with a plain sentence. It has two kinds of check: static (names, types, choices, spans) and content-dependent (unit strings, the trigger against the range). + - `check_changes(content: bytes, series: int, changes: dict) -> dict`: returns the normalised changes, or raises `SettingsValueError(ValueError)` with a plain sentence. It has two kinds of check: static (names, types, choices, limits) and content-dependent (unit strings, the trigger against the range). - `encode_setup(content: bytes, series: int, changes: dict) -> bytes`: - same length as `content`; - only the changed fields' bytes move; @@ -172,18 +172,21 @@ def test_read_compliance_content_refuses_a_missing_frame(): | `record_mode` | 4 | `[5]` | `waveform`=1, `manual`=2, `histogram`=3, `combo`=4 | | `sample_rate` | 3, 4 | `[6:8]` u16 BE | {1024, 2048, 4096} | | `histogram_interval_s` | 3, 4 | `[8:10]` u16 BE | {2, 5, 15, 60, 300, 900} | -| `record_time_s` | 3, 4 | `[18:22]` f32 BE | 1.0 ≤ v ≤ 20.0 | -| `geo_trigger_ips` | 3, 4 | ch k `+30` f32 BE, all three | 0.005 ≤ v ≤ 0.6, and ≤ the (new) range's full scale (10.0 / 1.25) | +| `record_time_s` | 3 | `[18:22]` f32 BE | 1.0 ≤ v ≤ `S3_MAX_RECORD_S[sample_rate]` = {1024: 104, 2048: 52, 4096: 26}, and ≤ 13 when `record_mode` is `histogram_continuous` (the **new** mode and rate if they change too) | +| `record_time_s` | 4 | `[18:22]` f32 BE | 1.0 ≤ v ≤ 90.0 | +| `geo_trigger_ips` | 3, 4 | ch k `+30` f32 BE, all three | 0.005 ≤ v ≤ 10.0, a multiple of 0.001 (within 1e-9), and ≤ the (new) range's full scale (10.0 / 1.25) | | `geo_range` | 3 | ch k `+29` u8, all three | `normal`=0, `sensitive`=1 | | `geo_alarm_ips` | 3 (gated) | ch k `+38` f32 BE, all three | 0.005 ≤ v ≤ full scale | -| `job_number` | 3, 4 | `[40:42]` u16 BE | 0 ≤ v ≤ 65535 | +| `job_number` | 3, 4 | `[40:42]` u16 BE | 1 ≤ v ≤ 9999 | | `job_number_shown` | 3, 4 | `[39]` bit `0x02` | bool | | `note_1` … `note_4` | 3, 4 | value `[144+64n : 186+64n]`; label `[122+64n : 144+64n]` read only | printable ASCII 0x20–0x7E, ≤ 41 bytes, zero-filled to 42 | -Where the spans come from, recorded in the module as comments: -- **Trigger and record time:** 75,958 Blastware reports, 2016–2026, scanned 2026-11-03. 7,586 print a trigger: 0.005–0.500 in/s, 20 values, all in/s. 7,631 print a record time: 1.0–10.0 s. -- **The tops of the spans:** BE11529's 2026-04-20 writes and the UM20147 fixtures (trigger 0.6, record time 11), and BE9441's 10-26 setup (record time 20). -- **Job number:** bounded by its encoding (UM20147 keypad 0 → 1 → 1234). The read-back verifies it. +The limits are **the units' own, from Instantel's manuals** (Brian, 2026-11-03), cited in the module as comments: +- **Trigger** 0.005–10 in/s, steps of 0.001: MiniMate Plus manual 716U0101 Rev 15, Appendix *Series III Specifications*; Micromate manual 721U0201 Rev 06, *Geophone Trigger Level*. +- **Record time:** + - Micromate 1–90 s (*Record Time*). + - MiniMate: §4.4's *Maximum Record Times*, 1 MB unit, channels 1–4; §3.8.9, 13 s in Histogram Combo. +- **Job number** 1–9999: both manuals. **A level write is refused** unless all three geophone channels' unit string, `ch +34:+38` with NULs and `.` stripped, equals `in`. Measured: `in.` and `in` both occur on UM20147. A unit set to Metric is unmeasured. @@ -203,8 +206,11 @@ def test_s4_fixture_pairs_reproduce(): # for every ordered pair (a, b) of tests/fixtures/micromate-setup/*.bin whose differing bytes outside # [2090:2092] all lie inside registry fields: encode_setup(a, 4, {f: field_values(b)[f] for differing f}) == b -def test_trigger_checked_against_the_new_range(): ... # Series 3: {"geo_range": "sensitive", "geo_trigger_ips": 0.6} passes; a fake full scale below 0.6 refuses -def test_spans_refuse_outside_values(): ... # 0.004 and 0.61 in/s; 0.9 and 20.1 s; sample rate 8192; interval 30 +def test_trigger_checked_against_the_new_range(): ... # Series 3: {"geo_range": "sensitive", "geo_trigger_ips": 2.0} refuses (above 1.25); 1.25 passes; {"geo_trigger_ips": 2.0} alone on Normal passes +def test_limits_refuse_outside_values(): ... # 0.004 and 10.001 in/s; 0.3005 (not a 0.001 step); job 0 and 10000; S4 0.9 and 90.1 s; + # S3 at 4096 sps: 26 ok, 26.1 refused; S3 histogram_continuous: 13 ok, 13.1 refused; + # S3 {"sample_rate": 1024, "record_time_s": 100} passes from a 4096 sps block (the new rate counts); + # sample rate 8192; interval 30 def test_field_not_offered_for_the_series(): ... # geo_range on series 4 -> SettingsValueError naming the series def test_alarm_is_read_only_until_measured(): ... # Series 3 geo_alarm_ips -> SettingsValueError while S3_ALARM_WRITE_MEASURED is False def test_metric_unit_string_refuses_level_writes(): ... # ch +34 = b"mm\x00\x00" -> SettingsValueError; b"in.\x00" and b"in\x00\x00" pass diff --git a/docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md b/docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md index 1a9dd02..7954ce4 100644 --- a/docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md +++ b/docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md @@ -221,14 +221,27 @@ A field is offered only where it is measured for that series. Values are refuse unless they are among the measured choices: sample rates 1024/2048/4096, intervals 2/5/15/60/300/900 s, and each series' measured mode codes. -- **Numbers (my call; no unit limits are written down anywhere in the repo):** - - Refuse any value outside the span seen on real units. The builder derives - each span from the DL2 XML reports, the fixtures and the captures, and records - it in the codec with its source. SFM then never sends a value no unit has - been seen to hold. A span can be widened later on evidence. - - A geophone trigger or alarm must also be at or below the range's full scale - (10 / 1.25 in/s). When range and trigger change in one request, check the - trigger against the **new** range. +- **Numbers: the units' own limits (Brian, 2026-11-03: "I want to use the actual + unit limits, not just what we have done in the past").** From Instantel's + operator manuals in `~/seismo-relay/manuals/`: + - **Geophone trigger:** 0.005–10 in/s in steps of 0.001 (MiniMate Plus manual + 716U0101 Rev 15, Appendix *Series III Specifications*; Micromate manual + 721U0201 Rev 06, *Geophone Trigger Level*). It is also capped at the range's + full scale (10 / 1.25 in/s). When range and trigger change in one request, + check the trigger against the **new** range. + - **Record time:** + - Micromate: 1–90 s (*Record Time*). + - MiniMate: from 1 s to the manual's §4.4 *Maximum Record Times* for a + 1 MB unit, four channels, at the chosen sample rate: 104 s at 1024 sps, + 52 s at 2048, 26 s at 4096. In Histogram Combo, 13 s (§3.8.9). The units + measured report about 960 KB in total memory (BE11529: 983,026 bytes), the + 1 MB model. + - **Job number:** 1–9999 (both manuals). + - **The read-back is the safety net.** A unit that does not take a value (for + instance, cuts a record time to what its memory allows) shows as not taken, + with what it actually holds. + - Values seen across 75,958 Blastware reports (2016–2026) sit well inside these + limits: trigger 0.005–0.500 in/s, record time 1–10 s, job number 1. - **Units:** refuse a level write unless the channel's unit string reads the measured one (`in.` for a geophone). A unit set to Metric is unmeasured. - **Notes:** edited by slot, under the label the unit itself shows (labels can be @@ -338,8 +351,8 @@ intervals 2/5/15/60/300/900 s, and each series' measured mode codes. constant cannot be derived from anything SFM reads. The first bench write checks that the unit takes the block, and its menu shows the change. - **The `0x09` block is echoed as read**, as Blastware did on all nine April writes. -- **Numbers are bounded by what real units have been seen to hold**, and level - writes are refused unless the channel's unit string is the measured `in.`. +- **Level writes are refused unless the channel's unit string is the measured + `in.` / `in`** (a unit set to Metric is unmeasured). - **Notes are edited by slot under the unit's own labels**, four slots on each series. Series 3 extended notes and Series 4's separate location field wait. - **The legacy by-host write is retired**; the by-host form becomes read-only.