Compare commits
113
Commits
cbce00f8e1
...
main
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
# Line endings (2026-11-12): every text file is stored and checked out with LF,
|
||||||
|
# whatever tool or OS wrote it -- file types we have not invented yet included.
|
||||||
|
# The protocol reference and seismo_lab.py were CRLF, so any rewrite outside the
|
||||||
|
# Edit tool turned them into whole-file diffs, and merges into them had to be
|
||||||
|
# resolved byte by byte. Same rule as Terra-View's. tests/test_line_endings.py
|
||||||
|
# fails if a CRLF file gets in anyway.
|
||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
# Binary -- never converted.
|
||||||
|
*.bin binary
|
||||||
|
*.pdf binary
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.gif binary
|
||||||
|
*.ico binary
|
||||||
|
*.h5 binary
|
||||||
|
*.pkl binary
|
||||||
|
*.db binary
|
||||||
|
*.sqlite binary
|
||||||
|
*.zip binary
|
||||||
|
*.gz binary
|
||||||
|
*.xlsx binary
|
||||||
|
*.docx binary
|
||||||
|
|
||||||
|
# Test fixtures are recorded bytes -- Blastware's own reports and exports, unit
|
||||||
|
# captures, event files -- kept byte for byte as ground truth: never converted.
|
||||||
|
tests/fixtures/** -text
|
||||||
+722
-1
@@ -4,9 +4,502 @@ All notable changes to seismo-relay are documented here.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Unreleased
|
## v0.35.0 — 2026-11-16
|
||||||
|
|
||||||
|
**The file-only decode reaches 80 of Blastware's 88 report fields, and SFM
|
||||||
|
reads monitor logs (.MLG).**
|
||||||
|
|
||||||
|
Three lines of work ship together.
|
||||||
|
|
||||||
|
**The file-only decode, groups D (part 2), E and F.** 80 of Blastware's 88
|
||||||
|
report fields now match on every DL2 event, 47 at v0.34.0. The last 16 values,
|
||||||
|
in two causes, are left as they are by decision (Brian, 2026-11-11).
|
||||||
|
- **New, from the unit's own records in the file:**
|
||||||
|
- ZC frequency, peak displacement and times of peak
|
||||||
|
- the sensor check results
|
||||||
|
- the Monitor Log line
|
||||||
|
- over range (Blastware's `OORANGE`)
|
||||||
|
- **Fixed:**
|
||||||
|
- a range-1 mic read 8× high (7 DL2 events)
|
||||||
|
- the mic dB offset
|
||||||
|
- a unit without a mic lost its sensor-check traces
|
||||||
|
|
||||||
|
**Monitor logs (.MLG).** SFM reads Blastware's monitor logs and keeps each
|
||||||
|
unit's monitoring timeline: sessions, gaps and what each means, and call-ins,
|
||||||
|
including calls that left no file. It answers "was unit X monitoring at T",
|
||||||
|
which is what a shot report needs for a unit that did not trigger. Nothing flows
|
||||||
|
in until the watcher forwards `.MLG`s or they are bulk-imported.
|
||||||
|
|
||||||
|
**An escaped checksum is the checksum, not data (#58).** SFM's live reads no
|
||||||
|
longer carry a stray byte, which had corrupted the battery and memory status and
|
||||||
|
the call-home read.
|
||||||
|
|
||||||
|
Prod still overlays a paired ASCII report onto the decode. Retiring that overlay
|
||||||
|
is the plan's step 3 and is not part of this release.
|
||||||
|
|
||||||
|
⚠ **This release owes a backfill, about 8 hours on the NAS, and creates two
|
||||||
|
empty tables on first start.** There is no migration, and no stored event time
|
||||||
|
moves. See *Migration*.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **ZC frequency, peak displacement and times of peak come from the unit's own
|
||||||
|
event summary** (group D, part 2 of the file-only decode;
|
||||||
|
`feat/waveform-zc-displacement`, merged 2026-11-06). Measured on DL2
|
||||||
|
2026-11-05.
|
||||||
|
- **Where they are:** every event file carries the unit's per-channel
|
||||||
|
summary right after its embedded event record. It is a chain of
|
||||||
|
`[length][id][payload]` records, ids `0x32`–`0x35`, each holding min, max,
|
||||||
|
peak sample, half-period and a displacement integral (reference D.6.12).
|
||||||
|
Blastware prints these values as they are.
|
||||||
|
- **ZC frequency** = (rate / 2) / half-period, on every record type. It
|
||||||
|
matches 25,966 / 25,966 waveform and 253,958 / 253,958 histogram channel
|
||||||
|
values, including the words (">100", "N/A", "<1.0"). Above range the value
|
||||||
|
is Blastware's threshold, flagged, as when it comes from a report.
|
||||||
|
- **Peak displacement** = half the integral (new
|
||||||
|
`PeakValues.*_peak_disp_in`): 19,479 / 19,479.
|
||||||
|
- **Times of peak and the vector-sum time** now come from the unit's peak
|
||||||
|
samples. They differ from the samples' own only on O117I1NK.R70W, whose
|
||||||
|
stored samples wrap at the trigger. Blastware's own sample table has the
|
||||||
|
same wrapped values.
|
||||||
|
- **Why recomputing failed:** from the samples, ZC frequency had matched 46%
|
||||||
|
and displacement 84%. The unit computes them at full resolution.
|
||||||
|
- **Peak acceleration** stays Blastware's own computation from the samples.
|
||||||
|
The unit stores its own largest step too (`[15:21]`, inferred), and
|
||||||
|
Blastware ignores it.
|
||||||
|
- **Decode checker:** 59 of 88 fields now match on every DL2 event, 47 before
|
||||||
|
group D (run `20261105-140021`, 0 regressions). Still open: O117I1NK's three
|
||||||
|
accelerations and S353I5PZ.EP0W's Vert acceleration.
|
||||||
|
- ⚠ **Operational:** codec change.
|
||||||
|
- The next release bumps `TOOL_VERSION`, then runs `backfill_sidecars.py`
|
||||||
|
and `backfill_event_shape.py`: about 8 h on the NAS (v0.34.0's took
|
||||||
|
13:13 → 21:16 on 2026-11-05).
|
||||||
|
- No schema change, no migration, and no stored time moves.
|
||||||
|
- **Report-less events gain a ZC frequency** in the existing `*_zc_freq` /
|
||||||
|
`*_zc_above_range` columns, so Terra-View shows a frequency where it
|
||||||
|
showed "—".
|
||||||
|
- Report-paired events keep the report's values, which are equal. A
|
||||||
|
report's "<1.0" still overlays as no value until the overlay is retired.
|
||||||
|
- Displacement and times of peak are not stored in the DB or `.h5` yet.
|
||||||
|
- **Sensor check results come from the unit's own records** (group E of the
|
||||||
|
file-only decode; `feat/sensor-check-results`, merged 2026-11-07). Measured
|
||||||
|
on DL2 2026-11-06.
|
||||||
|
- **Where they are:** the header of each sensor-check record (`0x3c` Tran ..
|
||||||
|
`0x3f` MicL), whose traces `minimateplus/sensor_check.py` already decoded
|
||||||
|
(reference D.6.13).
|
||||||
|
- **What it holds:** channel type, status, frequency × 10, ratio × 10 and
|
||||||
|
amplitude in mV.
|
||||||
|
- **Blastware prints them as they are:**
|
||||||
|
- 209,943 / 209,943 geophone frequencies and ratios
|
||||||
|
- 69,975 / 69,975 mic frequencies and amplitudes
|
||||||
|
- the result: "Passed" at status 0, "Check" at any other, "Disabled"
|
||||||
|
when the check is off
|
||||||
|
- **"Check" is the unit's own verdict.** K559L6N1's Tran is a Check at
|
||||||
|
8.1 Hz and 3.3, inside every passing range. SFM keeps the status code; its
|
||||||
|
bits are not decoded.
|
||||||
|
- New `Event.sensor_check_results`: channel → `SensorCheckResult`, with
|
||||||
|
`result`, `status`, `freq_hz`, `ratio` and `amplitude_mv`.
|
||||||
|
- **The tail of every event file is one record chain:** event record →
|
||||||
|
unit's summary → sensor checks → footer. It ends exactly at the file's end
|
||||||
|
on all 70,041 DL2 files.
|
||||||
|
- SFM now reads none of it unless it does.
|
||||||
|
- An unknown id inside an intact chain leaves only that record unread.
|
||||||
|
Before, it left everything after it unread too.
|
||||||
|
- **Decode checker:** 71 of 88 fields now match on every DL2 event, 59
|
||||||
|
before (run `20261106-125854`, 0 regressions). All 12 sensor-check fields
|
||||||
|
match on every event that has them.
|
||||||
|
- ⚠ **Operational:** codec change.
|
||||||
|
- Rides the next release's `TOOL_VERSION` bump and backfill with group D
|
||||||
|
part 2.
|
||||||
|
- No schema change and no migration.
|
||||||
|
- The results are on the decoded event only. They are not stored in the
|
||||||
|
DB, sidecar or `.h5` yet. Report-paired events keep the report's values
|
||||||
|
in the sidecar.
|
||||||
|
- **The Monitor Log line comes from the file's footer** (group F;
|
||||||
|
`feat/monitor-log`, merged 2026-11-09). Measured on DL2 2026-11-08.
|
||||||
|
- Blastware prints one line per event: the footer's start and stop, then
|
||||||
|
words for the footer's flag word `[18:20]` (reference D.6.14).
|
||||||
|
- The words: Event Recorded, then how the session ended — Keyboard, Remote
|
||||||
|
or Modem Exit, Timer Stop, Selfcheck Passed, Battery Low or Memory Full
|
||||||
|
Exit.
|
||||||
|
- Rebuilt that way it equals Blastware's line character for character on
|
||||||
|
69,983 / 69,983 DL2 lines.
|
||||||
|
- One line sets two session-end bits and prints the higher, so the order
|
||||||
|
of the others is inferred.
|
||||||
|
- Footer `[20:22]` is the trigger source again. `[24:26]` is still unknown.
|
||||||
|
- New `Event.monitor_log`: `MonitorLogLine(start, stop, flags,
|
||||||
|
description)`. It is read only when the record chain is whole, which
|
||||||
|
proves the footer.
|
||||||
|
- **Decode checker:** 72 of 88 fields now match on every DL2 event, 71
|
||||||
|
before (run `20261108-034313`, 0 regressions).
|
||||||
|
- ⚠ **Operational:** codec change. It rides the next release's
|
||||||
|
`TOOL_VERSION` bump and backfill. No schema change. The line is on the
|
||||||
|
decoded event only: not stored in the DB, sidecar or `.h5` yet.
|
||||||
|
- **Over range from the unit's own peaks: Blastware's `OORANGE`**
|
||||||
|
(`feat/decode-last-fields`, merged 2026-11-11; measured on DL2 2026-11-09;
|
||||||
|
reference D.6.15).
|
||||||
|
- **The rule:** a peak past full scale, 2,000 units (32,000 counts on
|
||||||
|
either geophone range; the mic in counts), is `OORANGE`. It holds per
|
||||||
|
channel and per histogram interval, from the unit's summary peaks, which
|
||||||
|
stay true where the stored samples clip or wrap.
|
||||||
|
- **The vector sum** is `OORANGE` exactly when a geophone is over: 43 / 43,
|
||||||
|
and never on its own (38 / 38 numeric, up to 14.49 in/s). That retracts
|
||||||
|
the open "vector sum alone" carve-out.
|
||||||
|
- **The report's "Out of Range" line** marks the mic over: 18 / 18.
|
||||||
|
- New `PeakValues.tran/vert/long/mic/pvs_over_range`, and
|
||||||
|
`event_file_io.over_full_scale()`.
|
||||||
|
- **Checker:** it matches `OORANGE` only by the flag, and a flag against a
|
||||||
|
printed number is a mismatch. The `saturation` carve-out now accepts no
|
||||||
|
DL2 event; it stays for a file without the unit's summary.
|
||||||
|
- **The checker reads each mic value in the unit Blastware printed.**
|
||||||
|
- The peak is read in its own `<Units>`, and a sample table by its cells
|
||||||
|
(a dB value is never under 60, psi never over 1). Blastware's event
|
||||||
|
`Units` line does not hold for the mic on every report.
|
||||||
|
- New carve-out `mic-units-mixed`, with evidence: a report that mixes dB
|
||||||
|
and psi in one mic column, or prints one unit in both mic columns of a
|
||||||
|
histogram row, is accepted when every differing cell is SFM's own value
|
||||||
|
in the other unit. 40 DL2 fields; a cell matching neither stays a
|
||||||
|
mismatch.
|
||||||
|
- **Decode checker:** **80 of 88 fields now match on every DL2 event**, 72
|
||||||
|
before (run `20261109-144544`, 0 regressions). What is left is 16 values
|
||||||
|
in two causes, left as they are by decision (Brian, 2026-11-11):
|
||||||
|
- the vector sum's last digit on 4 waveform/histogram twins: Blastware's is
|
||||||
|
about 1.5 ppm lower, cause unknown, and no fitted factor is applied;
|
||||||
|
- 4 accelerations: O117I1NK ×3 and S353I5PZ Vert.
|
||||||
|
- ⚠ **Operational:** codec change.
|
||||||
|
- It rides the next release's `TOOL_VERSION` bump and backfill.
|
||||||
|
- No schema change.
|
||||||
|
- The over-range flags are on the decoded event only: not stored in the
|
||||||
|
DB, sidecar or `.h5` yet.
|
||||||
|
- **Monitor logs (.MLG): SFM reads them and keeps each unit's monitoring
|
||||||
|
timeline** (`feat/mlg-import`, merged 2026-11-16). Spec
|
||||||
|
`docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md`.
|
||||||
|
- **Why (Brian, 2026-11-09):** every unit sends an `.MLG` at every call-in,
|
||||||
|
whatever its mode. A continuous-mode unit sends no event file on a quiet
|
||||||
|
day, so its `.MLG` is the only proof it was monitoring. That proof is what
|
||||||
|
a shot report attaches for a unit that did not trigger. Outage history is
|
||||||
|
the second use.
|
||||||
|
- **The format, measured** (reference D.4, rewritten):
|
||||||
|
- an 18-byte prefix, then length-led 292-byte records
|
||||||
|
- each record ends in a CRC-16/AUG-CCITT over `[0:288]`, little-endian:
|
||||||
|
3,329 / 3,329 records
|
||||||
|
- `minimateplus/mlg_file.py` reads it, checking every record's checksum,
|
||||||
|
and writes it: 16 / 16 real files rebuilt byte for byte
|
||||||
|
- the old unused writer in `blastware_file.py` (big-endian, a zero CRC
|
||||||
|
at the wrong end) is removed
|
||||||
|
- `minimateplus/crc.py` is the one CRC, now used by
|
||||||
|
`micromate/setup_block.py` too
|
||||||
|
- **Storage:** new tables `mlg_files` (one row per file received) and
|
||||||
|
`mlg_records` (one row per record, stored once). The original file is kept
|
||||||
|
under `<store>/<serial>/mlg/`.
|
||||||
|
- An empty file has no serial inside. It takes the longest known serial
|
||||||
|
its `<serial><counter>` name starts with, or is stored as unresolved,
|
||||||
|
never guessed.
|
||||||
|
- Only plain serials become directories.
|
||||||
|
- **The timeline** (`sfm/mlg_timeline.py`):
|
||||||
|
- **sessions:** how each ended, its events, and its trigger level as
|
||||||
|
logged
|
||||||
|
- **gaps and what each means:** call-in, scheduled off, lost power,
|
||||||
|
stopped by a person, memory full, no restart after a call-in, records
|
||||||
|
missing
|
||||||
|
- **clock steps:** the unit's clock steps back an hour at its first
|
||||||
|
call-in after daylight saving ends
|
||||||
|
- **call-ins:** delivered, no_file (a Modem Exit that left no file) and
|
||||||
|
nothing_new (an empty file)
|
||||||
|
- **"Was it monitoring at T"** answers monitoring / not_monitoring / unknown,
|
||||||
|
naming the records and file behind the answer. It never claims more than
|
||||||
|
the records show: a gap across a missing call-in number (files are
|
||||||
|
numbered) reads unknown.
|
||||||
|
- **Routes:** `POST /db/import/mlg_file`; `GET /db/units/{serial}/timeline`,
|
||||||
|
`/db/units/{serial}/monitoring_at`, `/db/mlg_records` and
|
||||||
|
`/db/mlg_files/{id}` (the original, for printing).
|
||||||
|
- **Tools:** `scripts/import_mlg_dir.py` (bulk import, with a dry run) and
|
||||||
|
`scratch/check_mlg_vs_events.py` (cross-check against the event files'
|
||||||
|
footers).
|
||||||
|
- **Measured on DL2's 1,273-file sample** (BE6907 and BE12844 from 2026,
|
||||||
|
BE8081 from 2018–19):
|
||||||
|
- 0 errors, 0 unresolved
|
||||||
|
- BE8081's 785 Event Recorded records match its 785 event files, both ways
|
||||||
|
- every recorded event falls inside a session
|
||||||
|
- two real outages: BE6907 recorded nothing for 14 days from 2026-10-07,
|
||||||
|
and BE8081 didn't restart after a failed call over Labor Day 2019
|
||||||
|
- ⚠ **Operational:**
|
||||||
|
- Two new tables are created on first start: no migration, no backfill,
|
||||||
|
no `TOOL_VERSION` bump (the event decode and the `.h5` files are
|
||||||
|
unchanged).
|
||||||
|
- Nothing arrives until `.MLG`s are imported. The watcher does not forward
|
||||||
|
them yet (`../series3-watcher`, Brian's call).
|
||||||
|
- DL2's full set (~86,000 files) loads with `scripts/import_mlg_dir.py`.
|
||||||
|
Load it from a robocopy copy: a Windows zip shifts summer file dates by
|
||||||
|
an hour.
|
||||||
|
- Terra-View shows none of it yet.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- **The mic's own range: a range-1 mic reads an eighth.**
|
||||||
|
- The mic's channel block has a range byte at the geophones' offset
|
||||||
|
(label + 29). At `1` each count is 0.25 / 8 Pa.
|
||||||
|
- It is set on 7 DL2 events, and SFM read their mic 8× high, e.g.
|
||||||
|
K557J1XQ.GF0W: 79.4 dB(L), not 97.5.
|
||||||
|
- It is independent of the geophone range.
|
||||||
|
- New `Event.mic_range`.
|
||||||
|
- ⚠ **Operational:** after the next release's backfill those events' DB
|
||||||
|
`mic_ppv`, and their `.h5` mic samples, drop 8×. Report-paired events
|
||||||
|
keep the report's value.
|
||||||
|
- **The mic dB offset is 81.938216**, not 81.9384.
|
||||||
|
- Every count Blastware printed in DL2 (1,704 in sample tables, 520 in
|
||||||
|
histogram intervals, 494 histogram peaks) leaves
|
||||||
|
[81.9382058, 81.9382266].
|
||||||
|
- It fixes mic values one digit off at a rounding edge (count 463: 135.2,
|
||||||
|
not 135.3).
|
||||||
|
- Operational: dB is not stored. SFM's own reports change in the last
|
||||||
|
digit at most.
|
||||||
|
- **The test suite runs green, with 0 failures.** The 16 long-standing "known
|
||||||
|
failures" were two stale tests:
|
||||||
|
- 15 ASCII-report tests read from a removed `decode-re/` folder;
|
||||||
|
- 1 expected 0.0 where the decoder deliberately leaves peaks unknown.
|
||||||
|
|
||||||
|
A report-pairing test that the same stale path had been skipping now runs.
|
||||||
|
- **A unit without a mic keeps its sensor-check traces.** The trace decoder
|
||||||
|
required all four records `0x3c`–`0x3f`, so BE16352 (no `0x3f`) had none in
|
||||||
|
its `.h5`: all 8 of its DL2 events. Its three geophone traces are now decoded.
|
||||||
|
- ⚠ Operational: they appear after the next release's backfill.
|
||||||
|
- **The decode checker reads the mic's above-range ZC flag under its real name**
|
||||||
|
(`mic_zc_above_range`). A mic ">100" could never match before.
|
||||||
|
- **An escaped checksum is the checksum, not data (#58;
|
||||||
|
`fix/escaped-checksum`, merged 2026-11-12).** Measured on every recorded
|
||||||
|
Series-3 reply.
|
||||||
|
- **The bug:** a MiniMate sends a checksum of 02, 03 or 04 as `10 X`.
|
||||||
|
`S3FrameParser` kept that `10` as the reply's last data byte, so the reply
|
||||||
|
read one byte long.
|
||||||
|
- **The evidence:** 60 recordings, March to October 2026, three units.
|
||||||
|
SUM8 of the unescaped payload is the checksum on 7,747 / 7,747 replies;
|
||||||
|
272 arrived escaped, and every one checks as an escape pair.
|
||||||
|
- **What it misread:**
|
||||||
|
- live status (SUB 1C): battery and memory are counted from the end. 12 of
|
||||||
|
760 recorded status replies read 419.84 V and 251,654,656 bytes, for
|
||||||
|
6.76 V and 983,026;
|
||||||
|
- the call-home read (SUB 2C) came out one byte long, and SFM refused the
|
||||||
|
unit as "monitoring".
|
||||||
|
- The settings and waveform reads already took only what they asked for
|
||||||
|
(benched 2026-11-04); those trims stay as guards.
|
||||||
|
- **The 5A file builder had compensated since April.** With the parser
|
||||||
|
fixed, that rule would drop a real `0x10` ending a chunk (one A5 chunk in
|
||||||
|
ten ends in one), so it is removed. The 8 recorded BE9441 events still
|
||||||
|
build byte for byte as Blastware's own files.
|
||||||
|
- **`.a5.pkl` frames:** `A5_PICKLE_VERSION` 2. `load_a5` drops the stray
|
||||||
|
`0x10` from version-1 frames; all 28 pickles on the dev box rebuild
|
||||||
|
byte-identical.
|
||||||
|
- **`checksum_valid` now sums the unescaped payload**, and every recorded
|
||||||
|
reply checks. It had read about a third of good replies as bad; nothing
|
||||||
|
decides on it.
|
||||||
|
- Operational: none for stored events (prod's Series-3 events arrive through
|
||||||
|
`save_imported_bw`, which keeps no frames). No schema change, no
|
||||||
|
`TOOL_VERSION` bump, no backfill.
|
||||||
|
|
||||||
|
### Protocol / Documentation
|
||||||
|
- **Reference D.6.12 (new):**
|
||||||
|
- the unit's event summary: its layout, and what Blastware prints from it
|
||||||
|
- why recomputing failed
|
||||||
|
- the two odd 2019 files
|
||||||
|
- group D part 1 (time of peak, acceleration with the fitted g),
|
||||||
|
documented there too
|
||||||
|
- **Reference §7.8.9:** its "constant, meaning ❓" bytes amended in place. They
|
||||||
|
are the vector-sum peak's sample, then the next record's lead.
|
||||||
|
- **Reference D.6.11 and CLAUDE.md:** the 59 / 88 status. Leads for E: records
|
||||||
|
`0x3c` / `0x3d`, probably the sensor check. Leads for F: a waveform's
|
||||||
|
monitor log may be its event record's start and stop.
|
||||||
|
- **Reference D.2 and D.4.2, corrected in place:** an `.MLG` stores its dates
|
||||||
|
little-endian, and its record flags are the event footer's flag word and
|
||||||
|
trigger source, little-endian. Measured on the 4 bench `.MLG` files; a
|
||||||
|
BE9441 session lines up 20 / 20 with its event files. `write_mlg()` writes
|
||||||
|
dates big-endian; nothing calls it.
|
||||||
|
- **Reference D.6.14 (new):** the monitor log. **D.3.3:** footer `[18:24]`
|
||||||
|
identified: flags, trigger source and zero.
|
||||||
|
- **Reference D.6.13 (new):**
|
||||||
|
- the record chain to the footer
|
||||||
|
- the sensor-check header and what Blastware prints from it
|
||||||
|
- **Reference D.3.3:** the footer is the chain's last record (`00 1a`, id `0e`).
|
||||||
|
- **Reference D.6.12:** its "`0x3c` / `0x3d`, before and after" retracted in
|
||||||
|
place. It is one record per channel.
|
||||||
|
- **Reference D.6.15 (new):** over range.
|
||||||
|
- **Reference D.6.6, corrected in place:** the mic's range byte; the dB offset
|
||||||
|
(the old window was too high); Blastware's mic unit labels and the mixed
|
||||||
|
columns.
|
||||||
|
- **Reference D.3.3:** the footer's last two bytes are a CRC-16/AUG-CCITT (init
|
||||||
|
`0x1D0F`), big-endian, over the footer record from its length prefix `00 1a`
|
||||||
|
through footer `[0:22]`. It holds on 70,041 / 70,041 DL2 files. Found by the
|
||||||
|
`.MLG` session; it retracts 2026-11-08's "no common CRC-16 fits".
|
||||||
|
- **Reference D.6.11 and CLAUDE.md:** the 80 / 88 status, and the two causes
|
||||||
|
left by decision.
|
||||||
|
- **Reference D.6, "Reading a mismatch":** 256, 4,096 and 65,536 mean a number
|
||||||
|
outgrew its 8-, 12- or 16-bit box. Every case so far is listed (Brian's
|
||||||
|
observation, 2026-11-05).
|
||||||
|
- **Reference D.4, rewritten:** the `.MLG` format, measured.
|
||||||
|
- Its framing, CRC and fields.
|
||||||
|
- How Blastware writes the files: one per call-in, no record repeated, and
|
||||||
|
a Modem Exit that is not a file's last record was a call that left no file.
|
||||||
|
- How a session appears, and the cross-check against the event files.
|
||||||
|
- The old D.4.1–D.4.3 (a 308-byte header, a CRC at each record's start) are
|
||||||
|
kept, marked retracted.
|
||||||
|
|
||||||
|
### Migration
|
||||||
|
|
||||||
|
⚠ **A backfill, no schema migration.** Not rehearsed on a prod snapshot.
|
||||||
|
|
||||||
|
**Before you start:**
|
||||||
|
- `TOOL_VERSION` is bumped to **0.35.0**, which gates the regeneration, so no
|
||||||
|
`--force` is needed.
|
||||||
|
- **Back up `seismo_relay.db` first.**
|
||||||
|
|
||||||
|
**Then:**
|
||||||
|
1. **Deploy.** On first start SFM creates `mlg_files` and `mlg_records`, both
|
||||||
|
empty. No other table changes, and no event row or id moves.
|
||||||
|
2. **In the `sfm` container, run `python scripts/backfill_sidecars.py`.** It
|
||||||
|
re-decodes every event file. ⚠ **Plan about 8 hours**: v0.34.0's run took
|
||||||
|
13:13 → 21:16 on 2026-11-05.
|
||||||
|
- **Report-less events gain a ZC frequency** in the existing `*_zc_freq` /
|
||||||
|
`*_zc_above_range` columns. Terra-View shows a frequency where it showed
|
||||||
|
"—".
|
||||||
|
- **The range-1 mic events' `mic_ppv` and `.h5` mic samples drop 8×** (7
|
||||||
|
in DL2; e.g. K557J1XQ.GF0W reads 79.4 dB(L), not 97.5). Report-paired
|
||||||
|
events keep the report's value.
|
||||||
|
- **A unit without a mic gets its geophone sensor-check traces** in its
|
||||||
|
`.h5` (BE16352's 8 DL2 events).
|
||||||
|
- **On the decoded event only, not stored in the DB or `.h5` yet:** the
|
||||||
|
sensor-check results, the Monitor Log line, over range, displacement and
|
||||||
|
times of peak.
|
||||||
|
- No stored event time moves.
|
||||||
|
3. **Run `python scripts/backfill_event_shape.py --db-path
|
||||||
|
bridges/captures/seismo_relay.db --store-root bridges/captures/waveforms`.**
|
||||||
|
It recomputes the shape and offset metrics.
|
||||||
|
4. **Optional, any time after: load DL2's `.MLG`s.**
|
||||||
|
- Copy `C:\Blastware 10\Event\autocall home` with robocopy, not a zip: a
|
||||||
|
Windows zip shifts summer file dates by an hour.
|
||||||
|
- Run `python scripts/import_mlg_dir.py <dir> --db-path ... --store-root
|
||||||
|
...`, with `--dry-run` first.
|
||||||
|
- On the dev box, a 1,273-file sample loaded in 13 s with 0 errors.
|
||||||
|
|
||||||
|
**Terra-View** needs no change: it reads rows by id. ZC frequencies appear,
|
||||||
|
and the range-1 mic values drop.
|
||||||
|
|
||||||
|
## v0.34.0 — 2026-11-04
|
||||||
|
|
||||||
|
**SFM reaches Series-4 parity, and reads most of Blastware's report from the
|
||||||
|
event file alone.**
|
||||||
|
|
||||||
|
Two lines of work ship together.
|
||||||
|
|
||||||
|
**Series-4 parity** (`feat/series4-sfm-parity`). One device door, by serial,
|
||||||
|
for both series. Each change is audited, identity-checked, sent once and read
|
||||||
|
back. Benched on BE9441 and UM20147.
|
||||||
|
- reads and downloads
|
||||||
|
- start / stop monitoring
|
||||||
|
- call-home on / off
|
||||||
|
- settings changes (preview → send → read back)
|
||||||
|
|
||||||
|
It also fixes MiniMate request framing (#46) and the 5A walk across a 64 KB
|
||||||
|
page.
|
||||||
|
|
||||||
|
**The file-only decode, groups A–D.** 47 of Blastware's 88 report fields now
|
||||||
|
match on every DL2 event, about 6 before v0.33.0. Eight more match on all but
|
||||||
|
one or two of 6,524 waveforms.
|
||||||
|
- **Fixed:**
|
||||||
|
- Sensitive-range events no longer read 8× high
|
||||||
|
- histograms the waveform codec had claimed, and short histograms with a
|
||||||
|
loud interval, now decode
|
||||||
|
- histograms are no longer a day late
|
||||||
|
- every histogram's start and stop are Blastware's own (#51), not a second
|
||||||
|
early
|
||||||
|
- interval frequencies follow the sample rate (#50)
|
||||||
|
- **New from the file:**
|
||||||
|
- the job number
|
||||||
|
- the unit's serial, version, calibration date and battery
|
||||||
|
- the trigger source and levels
|
||||||
|
- each interval's frequencies, vector sum and time
|
||||||
|
- the peak dates and times
|
||||||
|
- a waveform's time of peak and peak acceleration
|
||||||
|
- **Events are identified by unit + time + type:** a waveform and its histogram
|
||||||
|
may share a second.
|
||||||
|
|
||||||
|
Prod still overlays a paired ASCII report onto the decode. That overlay is the
|
||||||
|
plan's step 3 and is not part of this release.
|
||||||
|
|
||||||
|
⚠ **This release migrates the events table and owes a backfill that moves every
|
||||||
|
Series-3 histogram's stored time by one second.** See *Migration*.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- ✅ **MiniMate requests and config writes are framed as Blastware frames them
|
||||||
|
(#46; `feat/series4-sfm-parity`).**
|
||||||
|
- Every request escapes 02 / 03 / 04 / 10.
|
||||||
|
- A config write is an ordinary escaped request carrying a whole block (as
|
||||||
|
read, plus two bytes). All four blocks are checked before the first frame.
|
||||||
|
- SFM's frames equal Blastware's in the 2026-04-20 and 2026-10-26 captures.
|
||||||
|
Benched on BE9441 2026-11-04.
|
||||||
|
- ✅ **The 5A walk crosses a unit's 64 KB page.** The walk is 32-bit linear
|
||||||
|
(the CLAUDE.md "KNOWN BUG"); BE9441's page-crossing events rebuild Blastware's
|
||||||
|
own files byte for byte.
|
||||||
|
- A one-event download is whole or an error.
|
||||||
|
- A non-first event's stream has no metadata pages.
|
||||||
|
- **A MiniMate settings read is assembled as content** (measured at the bench
|
||||||
|
2026-11-04).
|
||||||
|
- Unescape each 1A frame and drop the one non-content byte that starts every
|
||||||
|
frame but the last: 2,090 bytes headed by N = 2090.
|
||||||
|
- The read takes exactly the length it asked for. When a reply's checksum
|
||||||
|
byte is itself escaped (about 1 frame in 85), the parser leaves its 0x10 in
|
||||||
|
the data. It hit the first live read; the recordings never had it. The
|
||||||
|
waveform-data read now trims it too.
|
||||||
|
- **A live download is held to its record type (#51):** a same-second
|
||||||
|
waveform / histogram twin is no longer skipped as "already stored". An untyped
|
||||||
|
row at that second still counts as stored.
|
||||||
|
- Smaller wire fixes from the parity benches:
|
||||||
|
- SUB 0x15's serial is cut at its first NUL.
|
||||||
|
- 0x1C reads a histogram run as monitoring.
|
||||||
|
- A MiniMate that boots on connect is waited for.
|
||||||
|
- A start's read-back waits out the sensor check and wakes the unit.
|
||||||
|
- A built call-home image is framed once.
|
||||||
|
|
||||||
|
- ✅ **#51: events are identified by unit + time + type, and histograms take
|
||||||
|
Blastware's times.**
|
||||||
|
- **The new key.** The events table was `UNIQUE(serial, timestamp)`, one
|
||||||
|
event per unit per second. A waveform and its histogram share a second
|
||||||
|
legitimately: 209 times in prod's 2026-09-30 store. The key is now
|
||||||
|
`UNIQUE(serial, timestamp, record_type)` (agreed with Brian 2026-11-03).
|
||||||
|
- **Migration 3** rebuilds the table from its own definition with only the
|
||||||
|
key swapped, in one transaction. Every column, row and id is kept, and
|
||||||
|
the indexes are recreated.
|
||||||
|
- **Lookups:** the upsert, the estimate guard and the restamp match on
|
||||||
|
type. The restamp also re-types a file's own row in place. An untyped
|
||||||
|
event still dedups against an untyped row.
|
||||||
|
- **Histogram times.** A histogram's start and stop now come from its own
|
||||||
|
event record (lead `00 28 05 00`, source `04 00`, marker `fe f5`). That is
|
||||||
|
Blastware's Histogram Start and Stop on 63,490 / 63,490 DL2 histograms; the
|
||||||
|
footer's start was a second early on 97%. Without a validated record, the
|
||||||
|
footer stands and the decoder logs a decode problem.
|
||||||
|
- **Interval times and peak times follow:**
|
||||||
|
- each interval's printed time is its end, start + (i + 1) × interval,
|
||||||
|
capped at the stop (2,308,524 / 2,308,524 rows; `interval_times`)
|
||||||
|
- each peak's date and time is its interval's
|
||||||
|
- **Decode checker:** 760,410 comparisons fixed, 0 regressions, **47 of 88**
|
||||||
|
fields fully match (was 34). Histogram start and stop times, interval
|
||||||
|
times and the ten peak date/time fields match every DL2 histogram.
|
||||||
|
- **Rehearsed on a copy of prod's 2026-09-30 snapshot (15,432 events):**
|
||||||
|
- The migration kept every row identical, rebuilt the indexes and passed
|
||||||
|
the integrity check, in 0.27 s.
|
||||||
|
- `backfill_sidecars.py`: 11,944 files, 0 errors. 9,852 Series-3
|
||||||
|
histograms moved +1 s in place, with no id lost and review state
|
||||||
|
untouched. The 209 same-second pairs coexist, and 0 collisions were
|
||||||
|
refused. (It also created 341 rows for store files that never had one:
|
||||||
|
the known one-time behaviour, not duplicates.)
|
||||||
|
- `backfill_event_shape.py`: exit 0, `cleared_stale` 0.
|
||||||
|
- ⚠ **Schema migration + codec change.** SFM migrates the events table by
|
||||||
|
itself on first start: back up `seismo_relay.db` first. The release
|
||||||
|
backfill (`backfill_sidecars.py` then `backfill_event_shape.py`) moves
|
||||||
|
every Series-3 histogram's stored time by one second, in place.
|
||||||
|
- Terra-View pairs twins by peak values and reads rows by id: no change
|
||||||
|
needed there.
|
||||||
|
- Note for Terra-View's changelog: Series-3 histograms move forward one
|
||||||
|
second, so an event can cross a deployment-window edge.
|
||||||
|
- Three tests that pinned the old footer start now pin the record's. The
|
||||||
|
estimate-guard test's neighbour is now the same type.
|
||||||
- **A Blastware file's geophone range comes from its setup, so Sensitive
|
- **A Blastware file's geophone range comes from its setup, so Sensitive
|
||||||
events no longer read 8× high.**
|
events no longer read 8× high.**
|
||||||
- **Where it is:** in the setup's channel blocks, the byte 29 after each
|
- **Where it is:** in the setup's channel blocks, the byte 29 after each
|
||||||
@@ -92,6 +585,154 @@ All notable changes to seismo-relay are documented here.
|
|||||||
change.
|
change.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
- **Series-4 parity in SFM: everything by serial, for both series**
|
||||||
|
(`feat/series4-sfm-parity`, merged 2026-11-04; spec
|
||||||
|
`docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md`).
|
||||||
|
- **One door, `DeviceAccess`.**
|
||||||
|
- A unit is addressed by its serial: UM is Series 4, BE / BA is Series 3.
|
||||||
|
The unit's own answer is checked before anything is sent.
|
||||||
|
- A Micromate's line is held between requests and released when idle or
|
||||||
|
on RADIO RING.
|
||||||
|
- One connection per unit; 423 while busy.
|
||||||
|
- **Reads, both series:** `GET /device/info`, `/device/monitor/status`,
|
||||||
|
`/device/settings`, `/device/events` and `POST /device/events/download`.
|
||||||
|
- A download is stored as the watcher stores it, through the Blastware /
|
||||||
|
IDF import path, typed.
|
||||||
|
- It never overwrites a stored event.
|
||||||
|
- SFM's MiniMate files carry Blastware's W/H type letter.
|
||||||
|
- **Changes, both series, each audited** (a `device_commands` row per
|
||||||
|
attempt), identity-checked, sent once, never retried, read back:
|
||||||
|
- start / stop monitoring;
|
||||||
|
- call-home on / off: `GET /device/call_home/state`,
|
||||||
|
`POST /device/call_home/{enable,disable}`;
|
||||||
|
- **settings**, `POST /device/settings/change`.
|
||||||
|
- **Settings, in detail:**
|
||||||
|
- A preview (dry run) shows old → new and returns a revision; a live
|
||||||
|
change must carry it, covering the unit's block and the changes asked for.
|
||||||
|
- Fields: record mode, sample rate, histogram interval, record time,
|
||||||
|
geophone trigger, the four notes, job number and its report flag, and
|
||||||
|
(MiniMate) range and alarm.
|
||||||
|
- Limits are the units' own, from Instantel's manuals, checked on the
|
||||||
|
block that would result.
|
||||||
|
- Refused before anything is sent: a monitoring unit, a stale preview, a
|
||||||
|
Micromate on its factory setup, or one whose schedule would load another
|
||||||
|
setup. SFM reads `schedule.dat`, read-only.
|
||||||
|
- **One settings codec for both series** (`micromate/setup_fields.py`): a
|
||||||
|
MiniMate's settings block is Series IV's `0x1A` layout. All 11 Blastware
|
||||||
|
compliance writes reproduce from the block before them.
|
||||||
|
- **The page:**
|
||||||
|
- units by serial, with the series badge from the unit's own answer;
|
||||||
|
- the events list and download, start / stop, the Call Home tab;
|
||||||
|
- the Config tab's Preview → Send → "the unit now holds";
|
||||||
|
- page JavaScript in `sfm/static/`, tested through Node (no inline JS).
|
||||||
|
- **Benched on BE9441 and UM20147:** phase 4 on 2026-11-03, phase 5 on
|
||||||
|
2026-11-04. Every change was acknowledged, read back and confirmed on the
|
||||||
|
unit's screen; both units were restored byte for byte.
|
||||||
|
- ⚠ A MiniMate's open setup menu loses a remote change when the operator
|
||||||
|
presses Cancel or Save (the menu writes its whole-block copy back). The
|
||||||
|
preview warns.
|
||||||
|
- ⚠ The Micromate scheduler switch is in no block SFM reads, so a leftover
|
||||||
|
schedule blocks a change even with the scheduler Off.
|
||||||
|
- ⚠ **Operational:** additive schema only. SFM creates `device_commands`, or
|
||||||
|
adds `sent` / `states` to an older one, on first start; this branch does not
|
||||||
|
touch `events`. No `TOOL_VERSION` bump and no backfill from this branch:
|
||||||
|
event decoding is unchanged. Production ingest (the watchers) is untouched;
|
||||||
|
the new device routes are used only from SFM's page and API.
|
||||||
|
- **A waveform's time of peak, vector-sum time and peak acceleration** (group D,
|
||||||
|
part 1 of the file-only decode). Measured on DL2 2026-11-04.
|
||||||
|
- **Time of peak** = (first peak sample − pre-trigger samples) / sample rate,
|
||||||
|
per channel including the mic.
|
||||||
|
- **The vector sum's time**: the same, on √(T² + V² + L²).
|
||||||
|
- **Peak acceleration** = the largest |v[i+1] − v[i]| × sample rate / g, which
|
||||||
|
the manuals describe as "subtracts two velocity readings and divides the
|
||||||
|
result by the elapsed time between them".
|
||||||
|
- Blastware's g is fitted: every printed acceleration in DL2 bounds it, and
|
||||||
|
together they leave [386.2236, 386.2240] in/s².
|
||||||
|
- That is 9.81 m/s² (386.2205) plus an offset not explained, as with the
|
||||||
|
mic's fitted dB offset. The standard 9.80665 m/s² fits 17,806 of
|
||||||
|
19,479 values; the fitted value fits 19,475.
|
||||||
|
- **`PeakValues` gains** `*_time_of_peak`, `pvs_time` and `*_peak_accel_g`,
|
||||||
|
filled for waveforms only.
|
||||||
|
- **Decode checker:** 52,177 comparisons fixed, 0 regressions. Times of peak
|
||||||
|
are 6,523 / 6,524 on every channel, peak acceleration 6,522–6,523 / 6,524.
|
||||||
|
Every miss is in two 2019 files (O117I1NK.R70W on all channels, S353I5PZ
|
||||||
|
on Vert), not yet explained.
|
||||||
|
- **Not shipped yet:** peak displacement and ZC frequency. They follow the
|
||||||
|
manuals' methods (half the largest half-cycle integral; the half-cycle at
|
||||||
|
the peak), but match only 84% and 46%, so Blastware does something more.
|
||||||
|
- ⚠ **Codec change:** it rides this release's `TOOL_VERSION` bump and
|
||||||
|
backfill. No schema change; the new values are not stored in the DB or
|
||||||
|
the `.h5` yet.
|
||||||
|
- **A histogram's interval detail: frequencies, vector sums, interval size and
|
||||||
|
stop** (group B of the file-only decode). Measured on DL2 2026-11-03.
|
||||||
|
- **Frequency** = (sample rate / 2) / half-period: 527,915 / 527,915 cells
|
||||||
|
at 1024 sps and 1,725 / 1,725 at 2048.
|
||||||
|
- ✅ **Fixes #50.** `half_period_to_hz` used a fixed 512 and halved every
|
||||||
|
2048-sps frequency. It now takes the rate (default 1024).
|
||||||
|
- Blastware prints "N/A" for a half-period of 0, ">100" (">200" at 2048)
|
||||||
|
at 5 samples or fewer, and "<1.0" below 1 Hz.
|
||||||
|
- **Each interval's vector sum**, √PVS² at the event's range.
|
||||||
|
- **Interval size:** uint16 seconds at `k − 40` (Series IV `[8:10]`).
|
||||||
|
- **Stop time:** the footer's.
|
||||||
|
- **`Event` gains** `histogram_interval_sec`, `interval_half_periods`,
|
||||||
|
`interval_pvs` and `stop_time`.
|
||||||
|
- **The `.h5` gains** `/intervals/half_period/<ch>` and `/intervals/pvs_ips`,
|
||||||
|
plus a `histogram_interval_sec` attribute.
|
||||||
|
- **Decoder:** a histogram is now walked once
|
||||||
|
(`histogram_codec.channels_from_records`).
|
||||||
|
- **Decode checker:** 508,080 comparisons fixed, 0 regressions, 34 of 88
|
||||||
|
fields fully match (was 28).
|
||||||
|
- Frequencies on all four channels, interval size and stop date match
|
||||||
|
every DL2 histogram.
|
||||||
|
- Interval vector sum: 63,497 match, plus 17 clipped intervals now under
|
||||||
|
the saturation carve-out. Blastware prints OORANGE when the sum exceeds
|
||||||
|
the range in an interval where it clamped a channel (17 / 17).
|
||||||
|
- 4 cells sit 4e-6 past a rounding boundary and stay mismatches.
|
||||||
|
- 58 stop times are Blastware a second earlier, part of #51.
|
||||||
|
- ⚠ **Codec change:** it rides the next release's `TOOL_VERSION` bump and
|
||||||
|
backfill. The `.h5` additions are additive. No schema change.
|
||||||
|
- **A Blastware file's identity, battery and trigger settings** (group A of the
|
||||||
|
file-only decode). Every field is matched against every DL2 report
|
||||||
|
(2026-11-03).
|
||||||
|
- **Identity block** before the setup name: what the live read gets from
|
||||||
|
SUB FE.
|
||||||
|
- serial `k − 202`, firmware `k − 147`, DSP version `k − 138`, firmware
|
||||||
|
minor `k − 193`
|
||||||
|
- calibration date `k − 132` and "by" `k − 128`
|
||||||
|
- manufacturer `k − 94`, model `k − 72`
|
||||||
|
- Filled into `Event.device_info`; `DeviceInfo` gains `calibration_date` /
|
||||||
|
`calibrated_by`.
|
||||||
|
- Serial, Version and Calibration match 70,042 / 70,042.
|
||||||
|
- **Battery:** uint16 hundredths of a volt at `k − 190`
|
||||||
|
(`Event.battery_volts`), 70,042 / 70,042. Blastware rounds half up
|
||||||
|
(6.25 → "6.3 Volts").
|
||||||
|
- **Trigger source:** the two bytes between the embedded event record's lead
|
||||||
|
and `fe 80`, a bitmask (`0x01` Tran, `0x02` Vert, `0x04` Long, `0x08`
|
||||||
|
MicL, `0x200` Manual). 6,524 / 6,524 (`Event.triggered_by`).
|
||||||
|
- **Trigger settings,** in Series IV's `0x1A` layout:
|
||||||
|
- the sources bitmask at `k − 19`
|
||||||
|
- the stop mode at `k − 31` (0 = Fixed)
|
||||||
|
- each channel's float32 level at label + 30 (geo in/s, mic psi)
|
||||||
|
- the mic type code at MicL + 4 (2 = Linear Weighting)
|
||||||
|
|
||||||
|
Blastware prints a level when its channel is a trigger source and the
|
||||||
|
event wasn't Manual. Geo level 6,484 / 6,484, mic level 4,412 / 4,412
|
||||||
|
(its dB uses 6895 Pa/psi).
|
||||||
|
- **`.h5`:** all of them as attributes (additive).
|
||||||
|
- **Decode checker:** 444,188 comparisons fixed, 0 regressions, 28 of 88
|
||||||
|
fields fully match (was 18).
|
||||||
|
- A mic level is now compared in the unit it is printed in: K441LA17.IN0W
|
||||||
|
prints dB under psi Units.
|
||||||
|
- New carve-out `units-is-a-display-preference` (3,532 events). dB or psi
|
||||||
|
in a Blastware report is that PC's Blastware preference when it wrote the
|
||||||
|
report (Blastware manual §4, Preferences → Units and Channel), not the
|
||||||
|
unit's Microphone Units setting (MiniMate Plus manual §3.9.7). DL2's
|
||||||
|
reports switch fleet-wide in 61 clean runs by write time, and no byte of
|
||||||
|
the file separates them.
|
||||||
|
- Single-value fields are proven for that value only: Version `10.72-8.17`,
|
||||||
|
stop mode Fixed, mic type Linear.
|
||||||
|
- ⚠ **Codec change:** it rides the next release's `TOOL_VERSION` bump and
|
||||||
|
backfill. No schema change.
|
||||||
- **A Blastware file's job number, and whether Blastware shows it.**
|
- **A Blastware file's job number, and whether Blastware shows it.**
|
||||||
- **Where it is:** the setup block has Series IV's `0x1A` layout here too.
|
- **Where it is:** the setup block has Series IV's `0x1A` layout here too.
|
||||||
The report flags sit at 9 bytes before the setup name, with bit `0x02`
|
The report flags sit at 9 bytes before the setup name, with bit `0x02`
|
||||||
@@ -113,7 +754,47 @@ All notable changes to seismo-relay are documented here.
|
|||||||
backfill (`backfill_sidecars.py` then `backfill_event_shape.py`). The new
|
backfill (`backfill_sidecars.py` then `backfill_event_shape.py`). The new
|
||||||
`.h5` attributes are additive. No schema change, no migration.
|
`.h5` attributes are additive. No schema change, no migration.
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- **`POST /device/config` and `POST /device/config/project` answer 410**,
|
||||||
|
pointing at `POST /device/settings/change`. Terra-View does not call them.
|
||||||
|
Removed with them, because they wrote a live unit through the encoder #46
|
||||||
|
found wrong:
|
||||||
|
- `MiniMateClient.apply_config`, `set_project_info` and
|
||||||
|
`_encode_compliance_config`;
|
||||||
|
- `poc_set_project.py`, and `experiments.py`'s EXP6.
|
||||||
|
|
||||||
### Protocol / Documentation
|
### Protocol / Documentation
|
||||||
|
- **The parity benches in both protocol references:**
|
||||||
|
- Series III: the settings write measured end to end, the escaped-checksum
|
||||||
|
stray byte, the keypad menu writing its whole-block copy back, the alarm at
|
||||||
|
channel +38, and `[26:28]` re-set while monitoring.
|
||||||
|
- Series IV: the first setup push, with the unit's CRC equal to SFM's; the
|
||||||
|
schedule read on a real unit; the scheduler switch in none of the blocks.
|
||||||
|
- Spec and plan: `docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md`,
|
||||||
|
`docs/superpowers/plans/2026-11-03-sfm-phase5-settings.md`.
|
||||||
|
- **Histogram timing in the protocol reference (D.6.10):**
|
||||||
|
- the histogram's own event record
|
||||||
|
- the interval-time and peak-time rules
|
||||||
|
- "histograms stay on ts1" retracted in place
|
||||||
|
- CLAUDE.md records the unit + time + type key
|
||||||
|
- Docs only.
|
||||||
|
- **Group B in the protocol reference (D.6.9):**
|
||||||
|
- interval size, the stop, and per-interval frequency, with Blastware's
|
||||||
|
words (`N/A`, `>100` / `>200`, `<1.0`)
|
||||||
|
- each interval's vector sum, with its OORANGE rule
|
||||||
|
- #50's fixed-512 formula is retracted in place
|
||||||
|
- CLAUDE.md and the README roadmap follow
|
||||||
|
- Docs only.
|
||||||
|
- **Group A in the protocol reference, and the three meanings of mic
|
||||||
|
"units".**
|
||||||
|
- **D.6.8:** the identity block, the trigger-source bitmask and the trigger
|
||||||
|
settings.
|
||||||
|
- **D.6.6:** recorded data vs report units vs unit peaks, with the
|
||||||
|
MiniMate Plus and Blastware manual sections. CLAUDE.md carries the same
|
||||||
|
glossary.
|
||||||
|
- 🔶 Inferred: the histogram "terminal tail" `9c 06 00 42` is `9c 06 00`
|
||||||
|
plus the serial's `B`.
|
||||||
|
- Docs only: no code change, no migration.
|
||||||
- **Where file-only decoding stands, and that prod's ASCII overlay is
|
- **Where file-only decoding stands, and that prod's ASCII overlay is
|
||||||
scaffolding.**
|
scaffolding.**
|
||||||
- **CLAUDE.md "Where things stand"** now says plainly that a paired
|
- **CLAUDE.md "Where things stand"** now says plainly that a paired
|
||||||
@@ -155,6 +836,46 @@ All notable changes to seismo-relay are documented here.
|
|||||||
- **CLAUDE.md "Where things stand"** now reflects the range fix.
|
- **CLAUDE.md "Where things stand"** now reflects the range fix.
|
||||||
- Docs only: no code change, no migration.
|
- Docs only: no code change, no migration.
|
||||||
|
|
||||||
|
### Migration
|
||||||
|
|
||||||
|
⚠ **Schema migration and backfill.** Rehearsed twice on a copy of prod's
|
||||||
|
2026-09-30 snapshot (15,432 events), before and after the parity merge, with
|
||||||
|
identical results.
|
||||||
|
|
||||||
|
**Before you start:**
|
||||||
|
- `TOOL_VERSION` is bumped to **0.34.0**, which gates the regeneration, so no
|
||||||
|
`--force` is needed.
|
||||||
|
- **Back up `seismo_relay.db` first.**
|
||||||
|
|
||||||
|
**Then:**
|
||||||
|
1. **Deploy.** On first start SFM migrates the database by itself.
|
||||||
|
- The events table is re-keyed `UNIQUE(serial, timestamp, record_type)`
|
||||||
|
(Migration 3): every row and id is kept and the indexes are rebuilt.
|
||||||
|
Rehearsal: 0.27 s, every row identical, integrity ok.
|
||||||
|
- `device_commands` is created.
|
||||||
|
2. **In the `sfm` container, `python scripts/backfill_sidecars.py`** re-decodes
|
||||||
|
every event file. ⚠ **Plan an overnight run:** the store holds about 64,000
|
||||||
|
events after the 2200-day watcher forward, at about 1.5 files/s on the NAS,
|
||||||
|
so roughly 12 hours.
|
||||||
|
- **Every Series-3 histogram's time moves forward one second, in place**,
|
||||||
|
with id and review state kept. Rehearsal: 9,852 moved, 0 refused, no id
|
||||||
|
lost.
|
||||||
|
- **The same-second waveform/histogram pairs coexist** (209 in the
|
||||||
|
snapshot).
|
||||||
|
- It also creates a row for any store file that never had one (341 in the
|
||||||
|
snapshot): the known one-time behaviour, not duplicates.
|
||||||
|
- **Report-less events** pick up every new field. **Report-paired events**
|
||||||
|
keep the report's overlaid peaks, notes, sample rate and record time.
|
||||||
|
3. **`python scripts/backfill_event_shape.py --db-path bridges/captures/seismo_relay.db
|
||||||
|
--store-root bridges/captures/waveforms`** recomputes shape and offset
|
||||||
|
metrics. Rehearsal: exit 0, `cleared_stale` 0.
|
||||||
|
|
||||||
|
**Terra-View** needs no change: it pairs twins by peak values and reads rows by
|
||||||
|
id. Moving a histogram forward one second can carry an event across a
|
||||||
|
deployment-window edge.
|
||||||
|
|
||||||
|
**Series-4** event times do not move.
|
||||||
|
|
||||||
## v0.33.0 — 2026-11-01
|
## v0.33.0 — 2026-11-01
|
||||||
|
|
||||||
**SFM reads Series-3 events from the file alone, and proves it against
|
**SFM reads Series-3 events from the file alone, and proves it against
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Ground-up Python replacement for **Blastware**, Instantel's Windows-only software for
|
Ground-up Python replacement for **Blastware**, Instantel's Windows-only software for
|
||||||
managing MiniMate Plus seismographs. Connects over direct RS-232 or cellular modem
|
managing MiniMate Plus seismographs. Connects over direct RS-232 or cellular modem
|
||||||
(Sierra Wireless RV50 / RV55). Current version: **v0.33.0**.
|
(Sierra Wireless RV50 / RV55). Current version: **v0.35.0**.
|
||||||
|
|
||||||
Stack-level context — which repo owns what, and how the three project versions
|
Stack-level context — which repo owns what, and how the three project versions
|
||||||
pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
|
pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
|
||||||
@@ -10,7 +10,7 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Where things stand (updated 2026-11-03)
|
## Where things stand (updated 2026-11-16)
|
||||||
|
|
||||||
Read this first when picking the project back up.
|
Read this first when picking the project back up.
|
||||||
|
|
||||||
@@ -31,6 +31,17 @@ Read this first when picking the project back up.
|
|||||||
3. switch ingest so reports are kept only for checking (retire the overlay)
|
3. switch ingest so reports are kept only for checking (retire the overlay)
|
||||||
4. stop the watchers forwarding reports
|
4. stop the watchers forwarding reports
|
||||||
- Until step 3, prod keeps the report as truth wherever one exists.
|
- Until step 3, prod keeps the report as truth wherever one exists.
|
||||||
|
- **🔑 Monitor logs (.MLG) and each unit's timeline (v0.35.0, 2026-11-16).**
|
||||||
|
- **What:** every unit sends an `.MLG` at every call-in, in every mode. SFM reads it
|
||||||
|
(`minimateplus/mlg_file.py`, reference D.4) and keeps each unit's monitoring timeline:
|
||||||
|
sessions, gaps and what they mean, clock steps, and the call-ins, including calls that
|
||||||
|
left no file.
|
||||||
|
- **Why (Brian, 2026-11-09):** shot reports need proof that a unit which did not trigger was
|
||||||
|
monitoring. Continuous-mode units send no file on a quiet day. Outage history is the
|
||||||
|
second use.
|
||||||
|
- **Spec:** `docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md`.
|
||||||
|
- **Not yet:** the watcher still does not forward `.MLG`s (its repo, Brian's call), and
|
||||||
|
Terra-View shows none of it.
|
||||||
- **🔑 The Series-3 decode checker (2026-10-29; v0.33.0).**
|
- **🔑 The Series-3 decode checker (2026-10-29; v0.33.0).**
|
||||||
- **Goal:** SFM produces everything Blastware reports, from the event file
|
- **Goal:** SFM produces everything Blastware reports, from the event file
|
||||||
alone (spec and plan in `docs/superpowers/`).
|
alone (spec and plan in `docs/superpowers/`).
|
||||||
@@ -45,13 +56,67 @@ Read this first when picking the project back up.
|
|||||||
- **Byte layouts** of every field read from the file:
|
- **Byte layouts** of every field read from the file:
|
||||||
`docs/instantel_protocol_reference.md` Appendix **D.6**.
|
`docs/instantel_protocol_reference.md` Appendix **D.6**.
|
||||||
|
|
||||||
**Where the decoder stands on `dev`** (2026-11-03, run `20261103-121047`):
|
**Where the decoder stands** (v0.35.0; run `20261109-144544`):
|
||||||
**18 of 88 fields match on every event**, up from about 6 before v0.33.0.
|
**80 of 88 fields match on every event**, up from about 6 before v0.33.0,
|
||||||
The four `dev` fixes below share one release and one backfill.
|
47 before group D and 59 after it. Every other field matches or is accepted
|
||||||
|
under a carve-out with its evidence.
|
||||||
|
- Groups A, B, C and D part 1 shipped in v0.34.0 (#50, #51).
|
||||||
|
- D part 2 (the unit's own summary), E (the sensor check), F (the monitor
|
||||||
|
log), over range and the mic fixes shipped in v0.35.0, with its backfill
|
||||||
|
(`TOOL_VERSION` 0.35.0).
|
||||||
|
- Left: 16 values in two causes -- the vector sum's last digit on 4
|
||||||
|
waveform/histogram twins, and 4 accelerations (reference D.6.11). Brian
|
||||||
|
decided 2026-11-11 to leave both as they are, documented.
|
||||||
|
- 🔑 **Events are keyed unit + time + type:** `UNIQUE(serial, timestamp,
|
||||||
|
record_type)` (#51, Migration 3 in `sfm/database.py`, `dev`).
|
||||||
|
- A waveform and its histogram may share a second: 209 times in prod's
|
||||||
|
2026-09-30 store.
|
||||||
|
- Any lookup "by event" must include the type.
|
||||||
|
- An untyped event still dedups against an untyped row.
|
||||||
|
- Rehearsed on a copy of the prod snapshot: rows and ids kept, 9,852
|
||||||
|
histograms moved +1 s in place.
|
||||||
- ✅ **Match on every event:**
|
- ✅ **Match on every event:**
|
||||||
- sample rate, record time, pre-trigger, notes and event type (v0.33.0)
|
- sample rate, record time, pre-trigger, notes and event type (v0.33.0)
|
||||||
- geophone range, job number, event times (6,524 / 6,524) and histogram
|
- geophone range, job number, event times (6,524 / 6,524) and histogram
|
||||||
start dates (63,518 / 63,518) — `dev`
|
start dates (63,518 / 63,518) — `dev`
|
||||||
|
- group A (`dev`, reference D.6.8): serial, version, calibration, battery,
|
||||||
|
trigger source, geo and mic trigger levels, stop mode, mic type
|
||||||
|
- group B (`dev`, D.6.9): interval frequencies, vector sums, size, stop
|
||||||
|
- group C (`dev`, D.6.10): histogram start and stop from the histogram's
|
||||||
|
own event record, interval times, and the peak dates and times
|
||||||
|
- group D (D.6.12): ZC frequency on every record type, peak displacement,
|
||||||
|
times of peak and the vector-sum time.
|
||||||
|
- These are **the unit's own values**, stored in the file right after
|
||||||
|
the event record. Blastware prints them; recomputing from the samples
|
||||||
|
reached only 46% and 84%.
|
||||||
|
- Peak acceleration is Blastware's own computation from the samples
|
||||||
|
(fitted g 386.2238): 6,522–6,523 / 6,524. The unit stores its own
|
||||||
|
too, which Blastware ignores. The misses are O117I1NK.R70W, whose
|
||||||
|
samples wrap at the trigger, and S353I5PZ.EP0W Vert (open).
|
||||||
|
- group E (D.6.13): sensor check frequency, ratio, mic amplitude and
|
||||||
|
result, every record type. Also the unit's own, in each sensor-check
|
||||||
|
record's header. "Check" is the unit's status code, not a limit SFM can
|
||||||
|
recompute.
|
||||||
|
- group F (D.6.14): the Monitor Log line. It is the footer's start and
|
||||||
|
stop plus words from the footer's flag word (Modem Exit, Timer Stop,
|
||||||
|
Keyboard Exit…), character for character on 69,983 / 69,983.
|
||||||
|
- 🔑 **The tail of every event file is one record chain** (D.6.13):
|
||||||
|
event record → unit summary → sensor checks → footer, each
|
||||||
|
`[length][id][payload]`. It ends exactly at the file's end on all 70,041
|
||||||
|
DL2 files, and SFM reads none of it otherwise.
|
||||||
|
- 🔑 **"Units" means three different things — keep them apart** (reference
|
||||||
|
D.6.6):
|
||||||
|
- **Recorded data:** the mic samples and interval peaks in the file, as
|
||||||
|
raw counts with no unit.
|
||||||
|
- **Report units:** dB(L) or psi(L) in a report.
|
||||||
|
- A Blastware report uses that PC's Blastware preference at the moment
|
||||||
|
it wrote the report; carve-out `units-is-a-display-preference`.
|
||||||
|
- SFM's report uses SFM's own fixed choice.
|
||||||
|
- **Unit peaks:** the unit's own summary, in its keypad Microphone Units
|
||||||
|
setting. Shown on its screen, in Blastware's event list, and in the 0C
|
||||||
|
record.
|
||||||
|
- Where the unit stores that setting is not measured yet; a keypad test
|
||||||
|
on a bench unit would show it.
|
||||||
- ✅ **Geophone samples** are exact on **6,524 / 6,524** waveforms in every
|
- ✅ **Geophone samples** are exact on **6,524 / 6,524** waveforms in every
|
||||||
year (`dev`; v0.33.0 had 6,491, its 33 others being Sensitive-range events
|
year (`dev`; v0.33.0 had 6,491, its 33 others being Sensitive-range events
|
||||||
read 8× high).
|
read 8× high).
|
||||||
@@ -63,24 +128,29 @@ Read this first when picking the project back up.
|
|||||||
- Blastware's "Number of Intervals" is the monitoring time ÷ the interval:
|
- Blastware's "Number of Intervals" is the monitoring time ÷ the interval:
|
||||||
a carve-out, 8 events.
|
a carve-out, 8 events.
|
||||||
- ✅ **Histogram PVS** = the stored per-interval PVS²: 69,989 / 70,042.
|
- ✅ **Histogram PVS** = the stored per-interval PVS²: 69,989 / 70,042.
|
||||||
**Mic:** one count = 0.25 Pa, dB offset 81.9384; a few dozen stragglers.
|
**Mic:** one count = 0.25 Pa (an eighth at mic range 1, the mic block's
|
||||||
|
label + 29), dB offset 81.938216 (2026-11-09; 81.9384 was too high).
|
||||||
|
- ✅ **Over range (D.6.15):** a peak past 2,000 units (32,000 counts; the
|
||||||
|
mic in counts) is Blastware's `OORANGE`, per channel and per interval; the
|
||||||
|
vector sum is `OORANGE` exactly when a geophone is, never on its own.
|
||||||
|
- 🔑 **Blastware's mic unit labels don't hold on every report** (D.6.6): the
|
||||||
|
peak carries its own `<Units>`, a sample table's cells say its unit, and
|
||||||
|
a few reports mix dB and psi in one column (carve-out `mic-units-mixed`).
|
||||||
- ❌ **Open:**
|
- ❌ **Open:**
|
||||||
- histogram start times are 1 s early (#51; fixing it moves every stored
|
- the vector sum's last digit on 4 waveform/histogram twins: Blastware's
|
||||||
histogram by 1 s, and the event key is (serial, time), so it needs a
|
value is ~1.5 ppm lower, cause unknown (no factor applied)
|
||||||
decision first)
|
- 4 accelerations (D.6.12)
|
||||||
- the mic stragglers: ~20 one-minute histograms with an interval or two off
|
|
||||||
- Blastware prints `OORANGE` when the vector sum alone exceeds the range
|
|
||||||
(a carve-out to prove)
|
|
||||||
- ⬜ **Not read yet, in the order proposed** (2026-11-03):
|
- ⬜ **Not read yet, in the order proposed** (2026-11-03):
|
||||||
- **A. Setup fields:** trigger source and levels, stop mode, mic type,
|
- ~~**A. Setup fields**~~ ✅ done on `dev`.
|
||||||
display units, firmware version, serial number, calibration, battery.
|
- ~~**B. Histogram interval detail**~~ ✅ done on `dev`. Frequencies (#50),
|
||||||
- **B. Histogram interval detail:** per-interval frequencies (#50: they
|
per-interval PVS, interval size, stop.
|
||||||
assume 1024 sps), per-interval PVS, interval size, stop time.
|
- ~~**C. #51 timing**~~ ✅ done on `dev`.
|
||||||
- **C. #51 timing:** start time, per-interval times, peak times.
|
- ~~**D. Blastware's waveform calculations**~~ ✅ done. ZC frequency,
|
||||||
- **D. Blastware's waveform calculations:** ZC frequency, acceleration,
|
displacement and time of peak are the unit's own (D.6.12); acceleration
|
||||||
displacement, time of peak.
|
is Blastware's.
|
||||||
- **E. Sensor check results.**
|
- ~~**E. Sensor check results**~~ ✅ done (D.6.13). Plus the traces of a
|
||||||
- **F. Monitor log:** probably not in the event file at all.
|
unit without a mic, which the trace decoder had been dropping.
|
||||||
|
- ~~**F. Monitor log**~~ ✅ done (D.6.14): in the footer after all.
|
||||||
- 🔶 **#48 is still open.** The event file's setup block puts the pre-trigger
|
- 🔶 **#48 is still open.** The event file's setup block puts the pre-trigger
|
||||||
where the 1A "stable anchor" `be 80 00 00 00 00` sits. In the file, though,
|
where the 1A "stable anchor" `be 80 00 00 00 00` sits. In the file, though,
|
||||||
it is **each event's own pre-trigger**, not the setting: 253–256 samples at
|
it is **each event's own pre-trigger**, not the setting: 253–256 samples at
|
||||||
@@ -285,6 +355,31 @@ Read this first when picking the project back up.
|
|||||||
menu. ⚠ **Neither series takes a call-home change while monitoring:** a MiniMate
|
menu. ⚠ **Neither series takes a call-home change while monitoring:** a MiniMate
|
||||||
returns its device-info block, and a Micromate acks the write and ignores it.
|
returns its device-info block, and a Micromate acks the write and ignores it.
|
||||||
SFM refuses both up front.
|
SFM refuses both up front.
|
||||||
|
**Phase 5 built 2026-11-03, benched 2026-11-04:** change a unit's settings by serial,
|
||||||
|
both series (`POST /device/settings/change`; the Config tab's Preview, then Send).
|
||||||
|
Spec `docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md`.
|
||||||
|
- 🔑 **A MiniMate's settings block IS Series IV's `0x1A` layout** (measured):
|
||||||
|
the 1A read assembles to 2,090 bytes headed by N = 2090, and all 11
|
||||||
|
Blastware compliance writes reproduce from the block before them. One codec
|
||||||
|
serves both series: `micromate/setup_fields.py`.
|
||||||
|
- Limits are the units' own, from Instantel's manuals (Brian). A live send
|
||||||
|
needs its preview's revision; refused up front: monitoring, a Micromate on
|
||||||
|
its factory setup or whose schedule would load another setup.
|
||||||
|
- Retired: `/device/config` (410), `apply_config`, `_encode_compliance_config`.
|
||||||
|
- **Benched 2026-11-04, both series:** every change acknowledged, read back,
|
||||||
|
and confirmed on the unit's screen; both units restored byte for byte. The
|
||||||
|
MiniMate alarm write is measured and now on.
|
||||||
|
- ⚠ **A MiniMate's open setup menu wins:** a change sent while it is open is
|
||||||
|
lost when the operator presses Cancel or Save (the menu writes its whole-block
|
||||||
|
copy back). The preview warns; nobody in the menus while the office sends.
|
||||||
|
- ~~⚠ An escaped checksum byte leaves a stray `0x10` in a Series-3 reply's data
|
||||||
|
(about 1 frame in 85).~~ **Fixed in the parser (#58, 2026-11-06, measured):**
|
||||||
|
a checksum of 02/03/04 arrives as `10 X`, and that `10` is never data (7,747 /
|
||||||
|
7,747 recorded replies check). It had misread 1C battery/memory (419.84 V) and
|
||||||
|
the 2C call-home read; the 5A file builder's own compensation is gone with it,
|
||||||
|
and pre-fix `.a5.pkl` frames are converted on load (pickle version 2).
|
||||||
|
- ⚠ The Micromate scheduler switch is not in any block SFM reads, so a leftover
|
||||||
|
schedule blocks a change even with the scheduler Off.
|
||||||
**Ring path measured the same night:** with THOR's watchdog off, a call-home
|
**Ring path measured the same night:** with THOR's watchdog off, a call-home
|
||||||
reaches THOR when nobody holds the line, and **is lost when SFM holds it** --
|
reaches THOR when nobody holds the line, and **is lost when SFM holds it** --
|
||||||
the unit takes SFM's connection for the call, times out and does not retry.
|
the unit takes SFM's connection for the call, times out and does not retry.
|
||||||
@@ -415,9 +510,11 @@ Read this first when picking the project back up.
|
|||||||
retracted 5A model: SUB 71's "offset 0x1004" reads as length 0x0400 escaped, and
|
retracted 5A model: SUB 71's "offset 0x1004" reads as length 0x0400 escaped, and
|
||||||
Blastware escapes `03` in write data. A write whose payload holds a bare
|
Blastware escapes `03` in write data. A write whose payload holds a bare
|
||||||
02/03/04/10 may be malformed. One Blastware config-write capture settles it.
|
02/03/04/10 may be malformed. One Blastware config-write capture settles it.
|
||||||
🔑 **Replies follow the same rule (measured, 748/748):** every 02/03/04/10 escaped,
|
🔑 **Replies follow the same rule (measured, 748/748; 7,747 / 7,747 across every
|
||||||
checksum = SUM8 of the unescaped payload. The "S3 checksums frequently fail" belief
|
recording, #58):** every 02/03/04/10 escaped, the checksum too, and checksum = SUM8
|
||||||
is `S3FrameParser` summing its output with the `10` of `10 02/03/04` still in it.
|
of the unescaped payload. The "S3 checksums frequently fail" belief was
|
||||||
|
`S3FrameParser` summing its output with the `10` of `10 02/03/04` still in it
|
||||||
|
(fixed 2026-11-06: `checksum_valid` holds on every recorded reply).
|
||||||
~~**⚠ KNOWN BUG — the 5A walk breaks once a unit's buffer crosses 64 KB.**~~
|
~~**⚠ KNOWN BUG — the 5A walk breaks once a unit's buffer crosses 64 KB.**~~
|
||||||
`parse_strt_end_offset()` returns only `(end_key[2] << 8) | end_key[3]`,
|
`parse_strt_end_offset()` returns only `(end_key[2] << 8) | end_key[3]`,
|
||||||
discarding the key's page byte. An event starting at `0x0111F2A2` and ending
|
discarding the key's page byte. An event starting at `0x0111F2A2` and ending
|
||||||
@@ -923,8 +1020,9 @@ with zero mismatches. Before: 1 of 1196.
|
|||||||
shows mic in dB(L) with ~6 dB quantization steps. Need to map
|
shows mic in dB(L) with ~6 dB quantization steps. Need to map
|
||||||
ADC counts → dB(L) for direct comparison; likely
|
ADC counts → dB(L) for direct comparison; likely
|
||||||
`dB = 20*log10(|counts|) + offset` or similar.~~ **Solved in v0.33.0.**
|
`dB = 20*log10(|counts|) + offset` or similar.~~ **Solved in v0.33.0.**
|
||||||
One count = 0.25 Pa, and dB(L) = 81.9384 + 20·log10(|count|), an offset
|
One count = 0.25 Pa, and dB(L) = 81.938216 + 20·log10(|count|), an offset
|
||||||
measured from Blastware's printed values (reference D.6.6).
|
measured from Blastware's printed values (reference D.6.6; 81.9384 until
|
||||||
|
2026-11-09).
|
||||||
- **Variable-prefix segment descriptors** — 3 of the 75 ground-truth
|
- **Variable-prefix segment descriptors** — 3 of the 75 ground-truth
|
||||||
production events still truncate. The walk reaches a segment header
|
production events still truncate. The walk reaches a segment header
|
||||||
whose channel-id field is preceded by a *variable-width* prefix (2, 4
|
whose channel-id field is preceded by a *variable-width* prefix (2, 4
|
||||||
@@ -1772,10 +1870,16 @@ GET /db/monitor_log?serial=BE11529&from_dt=&to_dt= ← monitoring intervals
|
|||||||
GET /db/sessions?serial=BE11529&limit=50 ← ACH call-home sessions, newest first
|
GET /db/sessions?serial=BE11529&limit=50 ← ACH call-home sessions, newest first
|
||||||
PATCH /db/events/{id}/false_trigger?value=true ← flag/unflag false triggers
|
PATCH /db/events/{id}/false_trigger?value=true ← flag/unflag false triggers
|
||||||
GET /db/device_commands?serial=UM20147&limit=100 ← start/stop audit trail (sent, states), newest first
|
GET /db/device_commands?serial=UM20147&limit=100 ← start/stop audit trail (sent, states), newest first
|
||||||
|
POST /db/import/mlg_file?serial=&call_in=true ← Blastware .MLG upload (form field mtimes = JSON {name: unix s UTC})
|
||||||
|
GET /db/units/{serial}/timeline?from_dt=&to_dt= ← sessions, gaps (+ meaning), clock steps, call-ins, from .MLGs
|
||||||
|
GET /db/units/{serial}/monitoring_at?at= ← monitoring / not_monitoring / unknown at a unit-clock time
|
||||||
|
GET /db/mlg_records?serial=BE8081&from_dt=&to_dt= ← raw .MLG records, oldest first
|
||||||
|
GET /db/mlg_files/{id} ← the original .MLG, byte for byte
|
||||||
```
|
```
|
||||||
|
|
||||||
DB file: `bridges/captures/seismo_relay.db` (default; override with `--db-path` at startup).
|
DB file: `bridges/captures/seismo_relay.db` (default; override with `--db-path` at startup).
|
||||||
All DB endpoints are read-only except `PATCH /db/events/{id}/false_trigger`.
|
All DB endpoints are read-only except `PATCH /db/events/{id}/false_trigger` and the
|
||||||
|
`/db/import/*` uploads.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -1966,7 +2070,8 @@ A re-analysis in the prior session incorrectly concluded `section[1]` is always
|
|||||||
and is device-specific. The 2026-04-09 re-analysis confirms `section[1]` was right.
|
and is device-specific. The 2026-04-09 re-analysis confirms `section[1]` was right.
|
||||||
|
|
||||||
**IMPORTANT — `frame.data` has checksum already stripped** by `S3FrameParser._finalise()`
|
**IMPORTANT — `frame.data` has checksum already stripped** by `S3FrameParser._finalise()`
|
||||||
(`raw_payload = body[:-1]`; `data = raw_payload[5:]`). There is NO trailing checksum byte in
|
(`raw_payload` = the body less its checksum, and less the `10` of an escaped one since #58;
|
||||||
|
`data = raw_payload[5:]`). There is NO trailing checksum byte in
|
||||||
`section`. All relative-from-end offsets must account for this.
|
`section`. All relative-from-end offsets must account for this.
|
||||||
|
|
||||||
Battery and memory fields are present in **both** states:
|
Battery and memory fields are present in **both** states:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# seismo-relay `v0.33.0`
|
# seismo-relay `v0.35.0`
|
||||||
|
|
||||||
A ground-up replacement for **Blastware** — Instantel's aging Windows-only
|
A ground-up replacement for **Blastware** — Instantel's aging Windows-only
|
||||||
software for managing seismographs. Supports both the **MiniMate Plus
|
software for managing seismographs. Supports both the **MiniMate Plus
|
||||||
@@ -95,6 +95,38 @@ over direct RS-232 or cellular modem (Sierra Wireless RV50 / RV55).
|
|||||||
>
|
>
|
||||||
> ⚠ The deploy owes a backfill; it does not move event times. See the
|
> ⚠ The deploy owes a backfill; it does not move event times. See the
|
||||||
> changelog's *Migration*.
|
> changelog's *Migration*.
|
||||||
|
>
|
||||||
|
> **v0.34.0 (2026-11-04)** reaches Series-4 parity and reads most of
|
||||||
|
> Blastware's report from the event file alone.
|
||||||
|
> - **Series-4 parity:** one device door by serial for both series, with
|
||||||
|
> reads, downloads, start/stop, call-home and settings changes, each audited
|
||||||
|
> and read back. MiniMate request framing is fixed (#46).
|
||||||
|
> - **The file-only decode:** 47 of Blastware's 88 report fields match on
|
||||||
|
> every DL2 event, and 8 more on all but one or two.
|
||||||
|
> - Sensitive-range events are no longer 8× high.
|
||||||
|
> - Histograms decode correctly and carry Blastware's own times (#51).
|
||||||
|
> - Interval frequencies follow the sample rate (#50).
|
||||||
|
> - New from the file: the job number, serial, version, calibration,
|
||||||
|
> battery, trigger source and levels, interval detail, peak times and
|
||||||
|
> peak acceleration.
|
||||||
|
> - **Events are identified by unit + time + type.**
|
||||||
|
>
|
||||||
|
> ⚠ The deploy migrates the events table and owes an overnight backfill that
|
||||||
|
> moves every Series-3 histogram time by one second. See the changelog's
|
||||||
|
> *Migration*.
|
||||||
|
>
|
||||||
|
> **v0.35.0 (2026-11-16)** reaches 80 of Blastware's 88 report fields from the
|
||||||
|
> event file alone, and reads monitor logs.
|
||||||
|
> - **The file-only decode, groups D–F:** ZC frequency, displacement, times of
|
||||||
|
> peak, the sensor check, the Monitor Log line and over range, all from the
|
||||||
|
> unit's own records. A range-1 mic no longer reads 8× high.
|
||||||
|
> - **Monitor logs (.MLG):** SFM reads Blastware's `.MLG` files and keeps each
|
||||||
|
> unit's monitoring timeline, so it can answer "was unit X monitoring at T"
|
||||||
|
> for a shot report. See the `.MLG` endpoints below.
|
||||||
|
> - **An escaped checksum is the checksum, not data (#58).**
|
||||||
|
>
|
||||||
|
> ⚠ The deploy owes a backfill (about 8 hours on the NAS) and creates two
|
||||||
|
> empty tables. See the changelog's *Migration*.
|
||||||
> See [CHANGELOG.md](CHANGELOG.md) for full version history.
|
> See [CHANGELOG.md](CHANGELOG.md) for full version history.
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -253,6 +285,10 @@ Query the SQLite database written by `ach_server.py`. All read-only except
|
|||||||
| `GET` | `/db/monitor_log` | Monitoring intervals |
|
| `GET` | `/db/monitor_log` | Monitoring intervals |
|
||||||
| `GET` | `/db/sessions` | ACH call-home session history |
|
| `GET` | `/db/sessions` | ACH call-home session history |
|
||||||
| `PATCH` | `/db/events/{id}/false_trigger?value=true` | Flag / unflag false triggers |
|
| `PATCH` | `/db/events/{id}/false_trigger?value=true` | Flag / unflag false triggers |
|
||||||
|
| `GET` | `/db/units/{serial}/timeline?from_dt=&to_dt=` | A unit's monitoring timeline from its `.MLG`s: sessions (how each ended, events, trigger level), gaps and what each means, clock steps, call-ins (delivered / no_file / nothing_new). Times are the unit's own clock. |
|
||||||
|
| `GET` | `/db/units/{serial}/monitoring_at?at=` | Was the unit monitoring at `at`: `monitoring` / `not_monitoring` / `unknown`, with the session or gap that says so and the records and file behind it. |
|
||||||
|
| `GET` | `/db/mlg_records?serial=&from_dt=&to_dt=` | A unit's raw `.MLG` records, oldest first |
|
||||||
|
| `GET` | `/db/mlg_files/{id}` | The original `.MLG`, byte for byte (for printing or opening in Blastware) |
|
||||||
|
|
||||||
### File ingest endpoints
|
### File ingest endpoints
|
||||||
|
|
||||||
@@ -267,6 +303,7 @@ its Blastware filename and moved in place (see *Database* below).
|
|||||||
|--------|-----|-------------|
|
|--------|-----|-------------|
|
||||||
| `POST` | `/db/import/blastware_file` | Series III: `.AB0*` / `.N00` binaries + paired `_ASCII.TXT`. Source: `series3-watcher`. |
|
| `POST` | `/db/import/blastware_file` | Series III: `.AB0*` / `.N00` binaries + paired `_ASCII.TXT`. Source: `series3-watcher`. |
|
||||||
| `POST` | `/db/import/idf_file` | Series IV: `.IDFH` / `.IDFW` binaries + paired `.IDFW.txt` / `.IDFH.txt`. Source: `thor-watcher`. |
|
| `POST` | `/db/import/idf_file` | Series IV: `.IDFH` / `.IDFW` binaries + paired `.IDFW.txt` / `.IDFH.txt`. Source: `thor-watcher`. |
|
||||||
|
| `POST` | `/db/import/mlg_file` | Series III monitor logs (`.MLG`), with each file's modified time as a JSON form field `mtimes`. Each file stored once; a damaged file stores nothing. Source: `scripts/import_mlg_dir.py` today; `series3-watcher` does not forward `.MLG`s yet. |
|
||||||
|
|
||||||
### DB snapshot / restore endpoints
|
### DB snapshot / restore endpoints
|
||||||
|
|
||||||
@@ -383,13 +420,15 @@ reverse-engineering plan. The `micromate/idf_file.py` stub is where
|
|||||||
|
|
||||||
`ach_server.py` and the file-ingest endpoints write to
|
`ach_server.py` and the file-ingest endpoints write to
|
||||||
`bridges/captures/seismo_relay.db` (SQLite, WAL mode) via the `SeismoDb`
|
`bridges/captures/seismo_relay.db` (SQLite, WAL mode) via the `SeismoDb`
|
||||||
persistence layer. Three tables, all unit-keyed by serial number:
|
persistence layer. The main tables, all unit-keyed by serial number:
|
||||||
|
|
||||||
| Table | Key | Contents |
|
| Table | Key | Contents |
|
||||||
|-------|-----|----------|
|
|-------|-----|----------|
|
||||||
| `ach_sessions` | UUID | Per-call-home audit record: serial, timestamp, peer IP, events_downloaded, monitor_entries, duration_seconds |
|
| `ach_sessions` | UUID | Per-call-home audit record: serial, timestamp, peer IP, events_downloaded, monitor_entries, duration_seconds |
|
||||||
| `events` | UUID, UNIQUE(serial, timestamp) | Triggered events: timestamp, Tran/Vert/Long/VectorSum/Mic PPV, project/client/operator/sensor_location strings, sample_rate, record_type, false_trigger flag, **`device_family`** ("series3" / "series4"), `blastware_filename` (binary at-rest in `waveforms/`), sidecar references |
|
| `events` | UUID, UNIQUE(serial, timestamp) | Triggered events: timestamp, Tran/Vert/Long/VectorSum/Mic PPV, project/client/operator/sensor_location strings, sample_rate, record_type, false_trigger flag, **`device_family`** ("series3" / "series4"), `blastware_filename` (binary at-rest in `waveforms/`), sidecar references |
|
||||||
| `monitor_log` | UUID, UNIQUE(serial, start_time) | Monitoring intervals: serial, waveform_key, start_time, stop_time, duration_seconds, geo_threshold_ips |
|
| `monitor_log` | UUID, UNIQUE(serial, start_time) | Monitoring intervals from live 0x0A reads (`ach_server.py` only): serial, waveform_key, start_time, stop_time, duration_seconds, geo_threshold_ips |
|
||||||
|
| `mlg_files` | UUID, UNIQUE(file_name, sha256) | One row per Blastware `.MLG` received (v0.35.0): serial, size, record count, empty flag, call-in flag, the file's modified time, where the original is kept, and the call it came from (`last_stop`, `no_file_stops`) |
|
||||||
|
| `mlg_records` | UUID, UNIQUE(serial, start, stop, flag word, trigger source) | One row per `.MLG` log record, stored once: start, stop (NULL = monitoring started), flag word, trigger source, Blastware's text and trigger level |
|
||||||
|
|
||||||
**Deduplication is by `(serial, timestamp)`** — the device clock is the
|
**Deduplication is by `(serial, timestamp)`** — the device clock is the
|
||||||
stable natural key. Repeat call-homes or re-runs UPSERT the row in place,
|
stable natural key. Repeat call-homes or re-runs UPSERT the row in place,
|
||||||
@@ -514,6 +553,7 @@ Use **com0com** or **VSPD** to create the virtual COM pair on Windows.
|
|||||||
- [x] Monitor control (start/stop, status polling, battery/memory)
|
- [x] Monitor control (start/stop, status polling, battery/memory)
|
||||||
- [x] Monitor log entries (continuous monitoring intervals without full waveform download)
|
- [x] Monitor log entries (continuous monitoring intervals without full waveform download)
|
||||||
- [x] Blastware file ingest at `/db/import/blastware_file` (paired with `series3-watcher`)
|
- [x] Blastware file ingest at `/db/import/blastware_file` (paired with `series3-watcher`)
|
||||||
|
- [x] Blastware monitor logs (`.MLG`) at `/db/import/mlg_file`, and each unit's monitoring timeline (`/db/units/{serial}/timeline`, `/monitoring_at`) (v0.35.0)
|
||||||
|
|
||||||
**Series IV (Micromate / Thor) device support:**
|
**Series IV (Micromate / Thor) device support:**
|
||||||
- [x] Thor IDF file ingest at `/db/import/idf_file` (paired with `thor-watcher`, v0.18.0+)
|
- [x] Thor IDF file ingest at `/db/import/idf_file` (paired with `thor-watcher`, v0.18.0+)
|
||||||
@@ -523,7 +563,7 @@ Use **com0com** or **VSPD** to create the virtual COM pair on Windows.
|
|||||||
- [ ] Live-device protocol — pending codec
|
- [ ] Live-device protocol — pending codec
|
||||||
|
|
||||||
**Data persistence:**
|
**Data persistence:**
|
||||||
- [x] SQLite database (`seismo_relay.db`) with `events`, `monitor_log`, `ach_sessions` tables
|
- [x] SQLite database (`seismo_relay.db`) with `events`, `monitor_log`, `ach_sessions`, `device_commands`, `mlg_files` and `mlg_records` tables
|
||||||
- [x] Per-row `device_family` column ("series3" / "series4") for clean UI / unit-of-measurement dispatch (v0.19.0+)
|
- [x] Per-row `device_family` column ("series3" / "series4") for clean UI / unit-of-measurement dispatch (v0.19.0+)
|
||||||
- [x] Deduplication by `(serial, timestamp)` — natural key handles post-erase counter resets
|
- [x] Deduplication by `(serial, timestamp)` — natural key handles post-erase counter resets
|
||||||
- [x] UPSERT on re-import refreshes every device-authoritative field (peaks, project, sample_rate); preserves operator review state (`false_trigger`)
|
- [x] UPSERT on re-import refreshes every device-authoritative field (peaks, project, sample_rate); preserves operator review state (`false_trigger`)
|
||||||
@@ -647,18 +687,19 @@ Implementation steps (concrete):
|
|||||||
3. flip ingest so reports are kept only for checking (retire the overlay)
|
3. flip ingest so reports are kept only for checking (retire the overlay)
|
||||||
4. stop the watchers forwarding reports
|
4. stop the watchers forwarding reports
|
||||||
|
|
||||||
**Done so far: 18 of 88 report fields match on every DL2 event.**
|
**Done so far: 47 of 88 report fields match on every DL2 event.**
|
||||||
- In v0.33.0: setup fields, notes, event type, histogram PVS, mic.
|
- In v0.33.0: setup fields, notes, event type, histogram PVS, mic.
|
||||||
- On `dev`:
|
- On `dev`:
|
||||||
- the geophone range
|
- the geophone range
|
||||||
- the job number
|
- the job number
|
||||||
- histograms that decoded wrongly
|
- histograms that decoded wrongly
|
||||||
- the footer: no more day-late histograms; every waveform time exact
|
- the footer: no more day-late histograms; every waveform time exact
|
||||||
|
- serial, version, calibration, battery, trigger source and levels, stop mode, mic type
|
||||||
|
- histogram interval detail: frequencies (#50 fixed), per-interval PVS, interval size, stop
|
||||||
|
- histogram start, stop, interval and peak times (#51 fixed); events keyed unit + time + type
|
||||||
|
- A Blastware report's dB/psi is its PC's preference, not anything in the event file: a carve-out.
|
||||||
|
|
||||||
**Next:**
|
**Next:**
|
||||||
- setup fields still unread: trigger, stop mode, units, serial, calibration, battery
|
|
||||||
- histogram interval detail: frequencies (#50), per-interval PVS, interval size, stop time
|
|
||||||
- histogram start times (#51)
|
|
||||||
- the values Blastware computes itself: ZC frequency, acceleration, displacement, time of peak
|
- the values Blastware computes itself: ZC frequency, acceleration, displacement, time of peak
|
||||||
- the sensor check results
|
- the sensor check results
|
||||||
- the monitor log
|
- the monitor log
|
||||||
|
|||||||
@@ -11,6 +11,18 @@
|
|||||||
|
|
||||||
| Date | Section | Change |
|
| Date | Section | Change |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|
| 2026-11-13 | Appendix D.4 (rewritten), D.4.1–D.4.4 | ✅ **The `.MLG` format, measured.** An 18-byte prefix, then 292-byte records `[length 290 LE][id 0e a0 header / 0e 80 log][…][00 00][CRC]`. The CRC is **CRC-16/AUG-CCITT over `[0:288]`, little-endian** (3,329 / 3,329 records, 1,282 files). Fields: times with the year LE, the monitor-log flag word and trigger source LE, the serial, Blastware's text. Also: one file per call-in, how sessions appear, and a Modem Exit that is not a file's last record was a call that left no file. Cross-checked against DL2 event footers: 785 / 785 for BE8081. The old D.4.1–D.4.3 (308-byte header, CRC at the start) are kept, marked retracted. Reader/writer `minimateplus/mlg_file.py`. |
|
||||||
|
| 2026-11-11 | Appendix D.3.3 | ✅ **The footer's last two bytes are a CRC-16/AUG-CCITT** (init `0x1D0F`), big-endian, over the footer record from its length prefix `00 1a` through footer `[0:22]`: 70,041 / 70,041 DL2 files. Found by the `.MLG` session, verified here. Retracts 2026-11-08's "no common CRC-16 fits": every attempt had started at the footer itself. Same CRC family as the Series IV `0x1A` block's and the `.MLG` record's. |
|
||||||
|
| 2026-11-09 | Appendix D.6.15 (NEW), D.6.6, D.6.11 | ✅ **Over range and the mic.** **D.6.15:** a peak past full scale (2,000 units = 32,000 counts; the mic in counts) is Blastware's `OORANGE`, per channel and per histogram interval, from the unit's own summary peaks. The vector sum is `OORANGE` exactly when a geophone is (43 / 43); never on its own (38 / 38 numeric), which retracts D.6.11's open "vector sum alone" case. The `<OORANGE>` line marks the mic over (18 / 18). **D.6.6:** the mic has its own range byte (label + 29): at 1 a count is an eighth, 7 DL2 events SFM read 8× high. The dB offset is **81.938216**: [81.9383, 81.9385] was too high, and every count Blastware printed leaves [81.9382058, 81.9382266]. Blastware's mic unit labels do not hold on every report; some mix dB and psi in one column. **80 of 88 report fields now match on every DL2 event.** |
|
||||||
|
| 2026-11-08 | Appendix D.6.14 (NEW), D.3.3, D.6.11 | ✅ **The monitor log is in the footer.** Every DL2 report prints one Monitor Log line: the footer's ts1 and ts2, then words for the footer's flag word `[18:20]` (`0x0001` Event Recorded, `0x0002` Keyboard Exit, `0x0004` Remote Exit, `0x0008` Selfcheck Passed, `0x0010` Timer Stop, `0x0020` Modem Exit, `0x0200` Battery Low Exit, `0x0800` Memory Full Exit; the higher session-end bit wins, from one file). Rebuilt, it equals Blastware's character for character on 69,983 / 69,983. **D.3.3:** footer `[20:22]` is the trigger source again, `[22:24]` is zero; `[24:26]` still unknown, and no common CRC-16 or sum fits. **72 of 88 report fields now match on every DL2 event.** |
|
||||||
|
| 2026-11-06 | Appendix D.6.13 (NEW), D.3.3, D.6.11, D.6.12 | ✅ **The record chain to the footer, and the sensor check.** Walked from the event record, the chain (event `0x05` → unit's summary `0x32`–`0x35` → sensor checks `0x3c`–`0x3f` → footer `0x0e`) ends exactly at the file's end on all 70,041 DL2 files. The footer is its last record: `00 1a` is its length, `0e` its id. **Each sensor-check record's header holds the unit's results:** channel type `[2]`, status `[4]` (0 = passed), frequency × 10 `[5:7]`, ratio × 10 `[7:9]` and amplitude mV `[9:11]`. Blastware prints them as they are: 209,943 / 209,943 geophone frequencies and ratios, 69,975 / 69,975 mic frequencies and amplitudes. The result is Passed / Check / Disabled by status and type. The status is the unit's own verdict, its bits not decoded. D.6.12's "`0x3c` / `0x3d`, before and after" retracted in place: one record per channel. **71 of 88 report fields now match on every DL2 event.** |
|
||||||
|
| 2026-11-06 (2) | §3 (replies), SUB 1C, 2C, 15, 5A file build | ✅ **An escaped checksum is the checksum, not data (#58, measured).** A reply whose checksum is 02, 03 or 04 sends it as `10 X`, and `S3FrameParser` kept that `10` as the frame's last data byte (first seen on BE9441's 1A read, 2026-11-04). **Across every recorded reply** (60 captures, March to October 2026, three units) SUM8 of the unescaped payload is the checksum on **7,747 / 7,747**, widening 2026-10-26 (4)'s 748 / 748. **272** checksums arrived escaped; every one checks as an escape pair, and no checksum ever arrived as a bare 02/03/04. **What the stray byte did:** **SUB 1C** battery and memory are counted from the end, so 12 of 760 recorded status replies read 419.84 V and 251,654,656 bytes (for 6.76 V and 983,026). A **SUB 2C** call-home read came out one byte long and was refused as "monitoring". The **SUB 15 probe reply** (`00 00 00 00 0a …`, the same on BE11529, BE18189 and BE9441) always has an escaped checksum: 230 of the 272, harmless, as nothing reads it. The **5A file builder** had compensated since 2026-04-21 (the "split pair" rule). With the parser fixed, that rule would drop a real `0x10` ending a chunk (one A5 chunk in ten ends in one; none recorded with an escaped checksum as well), so it is removed. The 1A and 09 reads' length trims (2026-11-04) stay as guards. `checksum_valid` now sums the unescaped payload, and every recorded reply checks. |
|
||||||
|
| 2026-11-05 | Appendix D.6.12 (NEW), D.6.11, §7.8.9 | ✅ **The unit's own event summary, in every event file.** The embedded event record is the first of a `[length][id][payload]` chain. It holds the vector-sum peak's sample (6,492 / 6,493). Then one 22-byte record per channel, ids `0x32` Tran … `0x35` MicL: min, max, peak sample, **half-period** and a **displacement integral**. Blastware prints them as they are. **ZC frequency** = (rate / 2) / half-period, with the interval rule's words: 25,966 / 25,966 waveform and 253,958 / 253,958 histogram channel values. **Peak displacement** = half the integral: 19,479 / 19,479. Recomputing from the samples had reached 46% and 84%: the unit works at full resolution. **Times of peak** follow the unit's peak sample. That differs from the samples only on **O117I1NK.R70W**, whose stored samples wrap at the trigger by 65,536 counts (Blastware's own table has the same values). Peak acceleration is Blastware's own computation from the stored samples (group D part 1, documented here too). The unit stores its own largest step at `[15:21]` (inferred), which Blastware does not print. §7.8.9's "constant, meaning ❓" bytes amended in place. 59 of 88 report fields now match on every DL2 event (47 before group D). |
|
||||||
|
| 2026-11-04 | SUB 1A / 09 reads, SUB 68–74 settings write, the keypad | **SFM's settings write, benched on BE9441 (Brian at the unit; ~12 writes, each with his go).** **Every write** -- trigger 0.04 ↔ 0.05, a note, several fields at once (Project, job number + its report flag, trigger), the alarm 1.0 ↔ 1.5, and a full restore -- was acknowledged on all nine steps (`97 8C 8E×5 8D 7D 7C 96 8B 8D`), read back as sent, and **confirmed on the unit's own screen**; the unit ended byte for byte as found. Moved bytes were exactly the field's: trigger f32 at each geophone channel +30 (`+31..+33` moved), **alarm f32 at channel +38** (`+39` moved; the first Series-3 alarm write), job number `[40:42]`, its report bit `[39]` `0x02`, a note's value window. **`[26:28]`** went `01 7f` → `00 00` on SFM's first write (Blastware's value) and the unit **set `01 7f` again during the next monitoring session**. The **two bytes after the block** went out as `00 00` (Blastware sends a per-unit constant) and were taken. **🔑 Escaped-checksum artifact:** when a reply's checksum byte is itself escaped (02 / 03 / 04, ~1 frame in 85), `S3FrameParser` keeps the escape's `0x10` and strips only the byte after it, so the frame's data gains one trailing `0x10`. It hit the first live 1A read (frame B 1,026 bytes after the header); the 12 recorded reads never had. SFM's settings read and waveform read now take exactly the length they asked for. **🔑 The keypad menu wins:** a write sent while the setup menu was open was acknowledged and read back, then **lost when the operator pressed Cancel or Save** -- the menu writes its own copy of the **whole** block back (both times the block returned byte for byte to its state when the menu was opened). A keypad Cancel with nothing pending leaves the block unchanged. **While monitoring**, the 1A read returns the device-info block (SFM refuses, nothing sent), and the opening poll was answered only intermittently (2 of 3 attempts timed out). Code: `minimateplus.protocol.read_compliance_content` / `read_waveform_data_raw`, `micromate.setup_fields`; notes `~/bench-logs/2026-11-04-sfm-settings/`. |
|
||||||
|
| 2026-11-03 (5) | SUB 1A / 71 / 69 (settings read and write) | **The settings block, read and written as content (measured, BE9441's 10-26 recording and BE11529's 2026-04-20 captures).** **Read:** unescape each 1A data frame and take `data[11:]`; every frame but the last starts with one `00` that is not content; dropped, the frames join into **2,090 bytes headed by N = 2090: Series IV's `0x1A` content layout** (12 / 12 reads, Blastware's 4 × 512 + 42 and SFM's 1024 + 1024 + 42). The old "stable anchor" `be 80 00 00 00 00` is content `[12:18]` (pre-trigger −0.25 + stop mode Fixed). **Round trip:** the read after each of Blastware's two 10-26 writes equals the image it had just written, all 2,090 bytes (2 / 2). While monitoring, the read returns the device-info block (`0e 'BE9441' …`, 5 / 5). **`[26:28]`:** Blastware writes `00 00` on all 11 writes; the unit reads `01 7f` after a monitoring session (BE9441 10-26, BE11529 4-20 15:19) and sets it by itself; meaning unknown. **The two bytes after the block** (`[2090:2092]` of the 0x71 image) are Blastware's own per-unit constant -- `7c ea` on all nine of BE11529's writes, `0c e9` on both of BE9441's -- not the block's CRC-16/AUG, and in no reply of BE9441's three-hour session; SFM sends `00 00`. **`0x09` `[200:202]`:** Blastware echoed the unit's `8c 76` on all nine April writes; on 10-26 it read `17 17` and wrote `78 76` (read back so); meaning unknown. **Blastware re-renders the mic trigger level:** on BE11529's first write (4-20 15:19) the unit read 0.005 and 0.01 psi in its two `MicL` channel blocks (3 and 7; Series 3 carries 8 channel blocks of 48 bytes from `[1708]`, the second four prefixed `0x32`) and Blastware wrote 0.004983 and 0.010058 -- the same levels to its 0.1 dB; every other write left them alone. **Every one of the 11 Blastware writes reproduces** from the block before it with only the fields Blastware changed (plus that re-render and, on 10-26, the mic bit of `[25]`). Code: `minimateplus.protocol.assemble_compliance_content`, `read_compliance_content`, `micromate.setup_fields`; tests `tests/test_s3_settings_read.py`, `tests/test_setup_fields.py`. |
|
||||||
|
| 2026-11-03 (4) | Appendix D.6.10 (NEW), D.6.11 | ✅ **Histogram timing from its own event record (#51).** `00 28 05 00` `04 00` `fe f5` [start][stop]: Blastware's Histogram Start and Stop on 63,490 / 63,490 each; exactly one per histogram, start 0–1 s after the footer's ts1. Interval time = its end (start + (i + 1) × interval, capped at the stop), 2,308,524 / 2,308,524 rows; a peak's date/time = its interval's. Retracted: "histograms stay on ts1" (it held only while SFM's events were unique on serial + time; now unit + time + type). 47 of 88 report fields match on every DL2 event. |
|
||||||
|
| 2026-11-03 (3) | Appendix D.6.9 (NEW), D.6.10 | ✅ **Histogram interval detail.** Interval size = uint16 seconds at `k − 40`; stop = footer ts2. Frequency = (sample rate / 2) / half-period, 527,915 / 527,915 cells at 1024 sps and 1,725 / 1,725 at 2048 — **#50 retracted** (a fixed 512 halved 2048-sps frequencies). Blastware's words: `N/A` (half-period 0), `>100` / `>200` (≤ 5 samples), `<1.0`. Per-interval vector sum √PVS²: 63,497 histograms; `OORANGE` when over range with a clamped channel, 17 / 17. 34 of 88 report fields now match on every DL2 event. |
|
||||||
|
| 2026-11-03 (2) | Appendix D.6.6, D.6.8 (NEW), D.6.9 | ✅ **Identity, battery and trigger, from the file.** **D.6.8:** the identity block before the setup name is SUB FE's (serial `k − 202`, firmware `k − 147`, DSP `k − 138`, calibration `k − 132` + by `k − 128`, model `k − 72`; battery uint16 /100 at `k − 190`); all 70,042 / 70,042. The embedded event record's two unknown bytes are the **trigger source** bitmask (6,524 / 6,524). Trigger sources `k − 19`, stop mode `k − 31`, per-channel trigger level float32 at label + 30, mic type at MicL + 4 (Series IV's code). **D.6.6:** recorded data vs report units vs unit peaks, with the manual sections; a Blastware report's dB/psi is the PC's preference. 🔶 `9c 06 00 42` (the histogram "terminal tail") looks like `9c 06 00` + the serial's `B`. 28 of 88 report fields now match on every DL2 event. |
|
||||||
| 2026-11-03 | Appendix D.3.3, D.6.1, D.6.3, D.6.5, D.6.7, §8 | ✅ **File-only decode, second pass (on `dev`).** **D.3.3:** the footer is the file's last 26 bytes (70,041 / 70,041); an earlier stop-time record fooled the first-match search on 14 files, making histograms a day late. Its `[18:24]` is **not** fixed (retracted). **D.6.1:** STRT[18] now picks the codec; the waveform codec had claimed 2018 5 s histograms. **D.6.3:** the job number (flags `k − 9` bit `0x02`, uint16 at `k − 8`; 2,997 / 2,997). **D.6.5:** the PVS² high word is non-zero above 1.28 in/s (retracted "reads 0000"), so the layout check now uses peak ≤ PVS ≤ √3·peak (34,502,955 / 34,502,955); Blastware's "Number of Intervals" is the monitoring time ÷ the interval. **§8:** where the 1995 default-clock events come from. 18 of 88 report fields now match on every DL2 event. |
|
| 2026-11-03 | Appendix D.3.3, D.6.1, D.6.3, D.6.5, D.6.7, §8 | ✅ **File-only decode, second pass (on `dev`).** **D.3.3:** the footer is the file's last 26 bytes (70,041 / 70,041); an earlier stop-time record fooled the first-match search on 14 files, making histograms a day late. Its `[18:24]` is **not** fixed (retracted). **D.6.1:** STRT[18] now picks the codec; the waveform codec had claimed 2018 5 s histograms. **D.6.3:** the job number (flags `k − 9` bit `0x02`, uint16 at `k − 8`; 2,997 / 2,997). **D.6.5:** the PVS² high word is non-zero above 1.28 in/s (retracted "reads 0000"), so the layout check now uses peak ≤ PVS ≤ √3·peak (34,502,955 / 34,502,955); Blastware's "Number of Intervals" is the monitoring time ÷ the interval. **§8:** where the 1995 default-clock events come from. 18 of 88 report fields now match on every DL2 event. |
|
||||||
| 2026-11-03 | call home (SUB 2C / 7E / 7F) | **SFM's call-home write, measured both ways.** SFM's 0x7E image (`write_image` of the 0x2C read with byte 5 set, framed ONCE) and its 0x7F confirm reproduce Blastware's 2026-04-20 enable and disable writes byte for byte (BE11529; `tests/test_s3_call_home_bw_frames.py`). Live on BE9441, idle: a no-op, on and off were all acked (0x81 / 0x80) and read back, and the unit's menu agreed. Only byte 5 changes: no unit-maintained field, unlike Series 4's `[118:120]`. Byte 5 is read from the UNESCAPED block. ⚠ Unescaping is not idempotent, so a built image must never pass through `write_image` again: a call-in time of 16:02-16:04 is `10 02`-`10 04` in the image. ⚠ **While monitoring, the unit answers the 0x2C read with its DEVICE-INFO block** ('Instantel', 'MiniMate Plus', its serial), as it answers 1A. Idle again, minutes later, it returns the call-home block. So a monitoring unit's call-home cannot be read-modify-written; SFM refuses with 'stop monitoring first'. A blind write while monitoring stays untested on purpose. |
|
| 2026-11-03 | call home (SUB 2C / 7E / 7F) | **SFM's call-home write, measured both ways.** SFM's 0x7E image (`write_image` of the 0x2C read with byte 5 set, framed ONCE) and its 0x7F confirm reproduce Blastware's 2026-04-20 enable and disable writes byte for byte (BE11529; `tests/test_s3_call_home_bw_frames.py`). Live on BE9441, idle: a no-op, on and off were all acked (0x81 / 0x80) and read back, and the unit's menu agreed. Only byte 5 changes: no unit-maintained field, unlike Series 4's `[118:120]`. Byte 5 is read from the UNESCAPED block. ⚠ Unescaping is not idempotent, so a built image must never pass through `write_image` again: a call-in time of 16:02-16:04 is `10 02`-`10 04` in the image. ⚠ **While monitoring, the unit answers the 0x2C read with its DEVICE-INFO block** ('Instantel', 'MiniMate Plus', its serial), as it answers 1A. Idle again, minutes later, it returns the call-home block. So a monitoring unit's call-home cannot be read-modify-written; SFM refuses with 'stop monitoring first'. A blind write while monitoring stays untested on purpose. |
|
||||||
| 2026-11-02 | Appendix D.3.1, D.6 (NEW), §15 | ✅ **Event fields SFM reads from the file alone (v0.33.0, plus the range on `dev`).** New D.6 records the bytes and the DL2 verification for each field: the record type `STRT[18]`, the recording-setup block (sample rate, pre-trigger, record time, the four notes), the geophone range (label + 29 in the setup's channel blocks), each histogram interval's PVS², and the mic scale (one count = 0.25 Pa). **Retracted in place:** D.3.1's `STRT[20]` = record time (it is `00` on every DL2 file; the "70 s" SFM used to report was `STRT[18]`, the record-type byte), and the 2026-08-26 reading of sub-minute histogram records as little-endian (big-endian from byte 5 since v0.32.0, #47/#49). **For #48:** the file's copy of the block puts the pre-trigger where the 1A "stable anchor" `be 80 00 00 00 00` sits. In the file, though, it is each event's own pre-trigger, which varies on the same unit on the same day (253–256 samples at 1024 sps), and Blastware reports it per event. So the file says little about whether the live 1A loses its anchor, and #48 stays open. |
|
| 2026-11-02 | Appendix D.3.1, D.6 (NEW), §15 | ✅ **Event fields SFM reads from the file alone (v0.33.0, plus the range on `dev`).** New D.6 records the bytes and the DL2 verification for each field: the record type `STRT[18]`, the recording-setup block (sample rate, pre-trigger, record time, the four notes), the geophone range (label + 29 in the setup's channel blocks), each histogram interval's PVS², and the mic scale (one count = 0.25 Pa). **Retracted in place:** D.3.1's `STRT[20]` = record time (it is `00` on every DL2 file; the "70 s" SFM used to report was `STRT[18]`, the record-type byte), and the 2026-08-26 reading of sub-minute histogram records as little-endian (big-endian from byte 5 since v0.32.0, #47/#49). **For #48:** the file's copy of the block puts the pre-trigger where the 1A "stable anchor" `be 80 00 00 00 00` sits. In the file, though, it is each event's own pre-trigger, which varies on the same unit on the same day (253–256 samples at 1024 sps), and Blastware reports it per event. So the file says little about whether the live 1A loses its anchor, and #48 stays open. |
|
||||||
@@ -2272,6 +2284,13 @@ labels "unknown", after the notes and channel blocks.
|
|||||||
| `[M+10:M+18]` | **stop**, same format | = the footer's `ts2` on 7,836; one second before it on 99 ✅ |
|
| `[M+10:M+18]` | **stop**, same format | = the footer's `ts2` on 7,836; one second before it on 99 ✅ |
|
||||||
| `[M+18:M+40]` | `[+18]` `00` (7,933/7,935), `[+22:24]` `00 00`, `[+26:34]` eight `00`, `[+36]` `00`, `[+37:39]` `16 32`, `[+39]` `00` | constant; meaning ❓ |
|
| `[M+18:M+40]` | `[+18]` `00` (7,933/7,935), `[+22:24]` `00 00`, `[+26:34]` eight `00`, `[+36]` `00`, `[+37:39]` `16 32`, `[+39]` `00` | constant; meaning ❓ |
|
||||||
|
|
||||||
|
> ⚠ **AMENDED 2026-11-05 (measured on DL2):** the record is the first of a chain of
|
||||||
|
> `[length uint16 BE][id][payload]` records. `00 28 05` is length 40 and id `0x05`, so the
|
||||||
|
> next record starts at `M + 36`. `[M+22:M+26]` is the vector-sum peak's sample, a uint32 BE
|
||||||
|
> (its high bytes are the `00 00` above). The bytes from `[+36]` are the next record's lead,
|
||||||
|
> `00 16 32`: the unit's per-channel summary. Layout and what Blastware prints from it:
|
||||||
|
> Appendix D.6.12.
|
||||||
|
|
||||||
**Relations** (7,935/7,935): footer `ts1` (session start) ≤ trigger ≤ stop; and
|
**Relations** (7,935/7,935): footer `ts1` (session start) ≤ trigger ≤ stop; and
|
||||||
`(stop - trigger) - record time` lies in −3 … +6 s.
|
`(stop - trigger) - record time` lies in −3 … +6 s.
|
||||||
|
|
||||||
@@ -3386,6 +3405,11 @@ All waveform files share the same `00 12 03 00` type tag regardless of extension
|
|||||||
|
|
||||||
All timestamps in N00 and MLG files use an **8-byte big-endian format**:
|
All timestamps in N00 and MLG files use an **8-byte big-endian format**:
|
||||||
|
|
||||||
|
> ⚠ **CORRECTED 2026-11-09 (measured): MLG files store the year little-endian** (`ea 07` = 2026)
|
||||||
|
> in every timestamp of all 4 bench `.MLG` files (`example-events/`). §7.5 already recorded it.
|
||||||
|
> N00 / event files are big-endian, as below. The MLG is Blastware's own PC-side file; the
|
||||||
|
> event file is the unit's data. D.4.2 has the rest of the MLG's byte order.
|
||||||
|
|
||||||
| Byte | Field |
|
| Byte | Field |
|
||||||
|---|---|
|
|---|---|
|
||||||
| 0 | day (uint8) |
|
| 0 | day (uint8) |
|
||||||
@@ -3453,6 +3477,10 @@ The body is reconstructed from the raw A5 bulk waveform stream frames by strippi
|
|||||||
The footer terminates the N00 file. Its bytes come directly from the terminator A5 frame's inner content — do NOT reconstruct from event metadata.
|
The footer terminates the N00 file. Its bytes come directly from the terminator A5 frame's inner content — do NOT reconstruct from event metadata.
|
||||||
|
|
||||||
✅ **It is the file's last 26 bytes** (2026-11-03): `0e 08` and two valid times end every one of 70,041 DL2 files.
|
✅ **It is the file's last 26 bytes** (2026-11-03): `0e 08` and two valid times end every one of 70,041 DL2 files.
|
||||||
|
|
||||||
|
> 🔑 **2026-11-06 (measured):** it is the last record of the chain that starts with the event
|
||||||
|
> record (D.6.13). The two bytes before it, `00 1a`, are its length (26), and `0e` is its id.
|
||||||
|
> The chain lands exactly on it in all 70,041 DL2 files.
|
||||||
- ⚠ **Do not search for the first `0e 08` + plausible year.** 14 DL2 files also hold an earlier record of that shape, about 1.1 KB before the end, carrying the stop time followed by zeros.
|
- ⚠ **Do not search for the first `0e 08` + plausible year.** 14 DL2 files also hold an earlier record of that shape, about 1.1 KB before the end, carrying the stop time followed by zeros.
|
||||||
- Taking it made a histogram start at its own stop (a day late on BE9558's daily histograms). It also cost a waveform its stop, and with it the trigger time.
|
- Taking it made a histogram start at its own stop (a day late on BE9558's daily histograms). It also cost a waveform its stop, and with it the trigger time.
|
||||||
|
|
||||||
@@ -3461,16 +3489,150 @@ The footer terminates the N00 file. Its bytes come directly from the terminator
|
|||||||
| 0 | 2 | `0e 08` | Fixed marker |
|
| 0 | 2 | `0e 08` | Fixed marker |
|
||||||
| 2 | 8 | ts1 | Start timestamp (8B big-endian) |
|
| 2 | 8 | ts1 | Start timestamp (8B big-endian) |
|
||||||
| 10 | 8 | ts2 | Stop timestamp (8B big-endian) |
|
| 10 | 8 | ts2 | Stop timestamp (8B big-endian) |
|
||||||
| 18 | 6 | varies | ⚠ **Not fixed** (2026-11-03). `00 01 00 02 00 00` in M529LIY6.N00. Elsewhere: `00 21 04 00 00 00` (K558L9XP.FK0H, K439I2WY.RK0H, T1895KDW.6J0H), `00 01 02 00 00 00` (K5575KDW.5L0W), `00 01 00 01 00 00` (S3545KFL.S60W). Not identified |
|
| 18 | 6 | varies | ⚠ **Not fixed** (2026-11-03). `00 01 00 02 00 00` in M529LIY6.N00. Elsewhere: `00 21 04 00 00 00` (K558L9XP.FK0H, K439I2WY.RK0H, T1895KDW.6J0H), `00 01 02 00 00 00` (K5575KDW.5L0W), `00 01 00 01 00 00` (S3545KFL.S60W). Not identified. **Identified 2026-11-08, three rows below** |
|
||||||
| 24 | 2 | CRC | 2-byte CRC — algorithm unconfirmed |
|
| 18 | 2 | monitor-log flags | uint16 BE: the words of Blastware's Monitor Log line (D.6.14) ✅ 69,983 / 69,983 |
|
||||||
|
| 20 | 2 | trigger source | the event record's again: `00 01`–`00 08` a channel, `02 00` Manual, `04 00` a histogram ✅ 69,983 / 69,983 |
|
||||||
|
| 22 | 2 | `00 00` | 69,983 / 69,983 |
|
||||||
|
| 24 | 2 | CRC | 2-byte CRC — algorithm unconfirmed. ⚠ 2026-11-08: no common CRC-16 (XMODEM, CCITT-FALSE, AUG-CCITT, KERMIT, ARC, MODBUS, BUYPASS) nor a 16-bit sum, over the file, from STRT, after STRT or over the footer, fits 40 sampled files. That it is a checksum is not shown. **Retracted 2026-11-11: see the note below the table** |
|
||||||
|
|
||||||
**CRC:** The 2-byte CRC at footer[24:26] has an unconfirmed algorithm. In M529LIY6.N00 it reads `fe da`. Attempts to match CRC-16/CCITT, CRC-16/IBM, CRC-32 (truncated), and 40+ polynomial/init combinations all failed. The writer copies it verbatim from the terminator frame.
|
**CRC:** The 2-byte CRC at footer[24:26] has an unconfirmed algorithm. In M529LIY6.N00 it reads `fe da`. Attempts to match CRC-16/CCITT, CRC-16/IBM, CRC-32 (truncated), and 40+ polynomial/init combinations all failed. The writer copies it verbatim from the terminator frame.
|
||||||
|
|
||||||
### D.4 MLG File Format — Monitor Log
|
> ✅ **SOLVED 2026-11-11 (measured; found by the `.MLG` session, verified here):** footer
|
||||||
|
> `[24:26]` is a **CRC-16/AUG-CCITT** (poly `0x1021`, init `0x1D0F`), stored big-endian. It covers
|
||||||
|
> the footer record from its **length prefix**: the `00 1a` before the footer, then footer
|
||||||
|
> `[0:22]`, 24 bytes in all. The zero word `[22:24]` is not covered. Matches **70,041 / 70,041**
|
||||||
|
> DL2 files. Every earlier attempt, including AUG-CCITT, started at the footer itself and missed
|
||||||
|
> the length prefix. It is the same CRC family as the Series IV `0x1A` block's and the `.MLG`
|
||||||
|
> record's (D.4).
|
||||||
|
|
||||||
**File layout:** `[308B header] [N × 292B records]`
|
### D.4 MLG File Format — Monitor Log ✅ 2026-11-13
|
||||||
|
|
||||||
#### D.4.1 MLG Header (308 bytes)
|
Measured on **1,273 DL2 files** from Blastware's ACH folder (`C:\Blastware 10\Event\autocall
|
||||||
|
home`: BE6907 and BE12844 from 2026, BE8081 from 2018–19; local copy `~/dl2-archive/mlg/`) and
|
||||||
|
**9 bench files** (`example-events/`). Reader and writer: `minimateplus/mlg_file.py`. SFM's
|
||||||
|
storage and each unit's timeline: `docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md`.
|
||||||
|
|
||||||
|
**File layout:** an 18-byte prefix, then whole 292-byte records. The size is always
|
||||||
|
`18 + 292·n` (1,282 / 1,282 files) ✅.
|
||||||
|
|
||||||
|
#### D.4.1 The prefix and the records ✅
|
||||||
|
|
||||||
|
| Offset | Bytes | Field |
|
||||||
|
|---|---|---|
|
||||||
|
| 0 | 18 | prefix `10 00 01 80 00 00 "Instantel\0" 07 2c` (the event file's first 18 bytes) |
|
||||||
|
| 18 | 292 | the header record (absent in an empty file) |
|
||||||
|
| 310 | 292 × n | log records |
|
||||||
|
|
||||||
|
Every record, header and log alike:
|
||||||
|
|
||||||
|
| Offset | Bytes | Field |
|
||||||
|
|---|---|---|
|
||||||
|
| 0 | 2 | length, uint16 **LE** = `0x0122` (290): the bytes after it |
|
||||||
|
| 2 | 2 | id: `0e a0` the header record (always first), `0e 80` a log record |
|
||||||
|
| 4 | 284 | content (D.4.2) |
|
||||||
|
| 288 | 2 | `00 00`, not covered by the CRC |
|
||||||
|
| 290 | 2 | CRC (D.4.3), **LE** |
|
||||||
|
|
||||||
|
- **The header record** holds only the serial, at `[24:34]` (NUL-padded ASCII). Every other
|
||||||
|
byte of it is zero on all 1,273 DL2 files.
|
||||||
|
- **An empty file** is the 18-byte prefix alone: no header record, no serial. 231 of the 1,273
|
||||||
|
DL2 files are empty.
|
||||||
|
|
||||||
|
This is the same `[length][id][payload]` shape as the event file's record chain (D.6.13); the
|
||||||
|
log record's id `0e` is the footer's. The old reading below (a 308-byte header, a CRC at each
|
||||||
|
record's start) cut every record two bytes early: the "CRC" it saw at `record[0:2]` was the
|
||||||
|
previous record's tail.
|
||||||
|
|
||||||
|
#### D.4.2 A log record's fields ✅
|
||||||
|
|
||||||
|
Offsets from the record's length field:
|
||||||
|
|
||||||
|
| Offset | Bytes | Field |
|
||||||
|
|---|---|---|
|
||||||
|
| 4 | 8 | start: day, month, year **LE**, 0, hour, minute, second (D.2) |
|
||||||
|
| 12 | 8 | stop, same format; all zeros = no stop |
|
||||||
|
| 20 | 2 | monitor-log flag word, uint16 LE: the event footer's (D.3.3, D.6.14); `0xFFFF` = monitoring started |
|
||||||
|
| 22 | 2 | trigger source, uint16 LE: `0x0001`–`0x0008` a channel, `0x0400` a histogram, 0 none |
|
||||||
|
| 24 | 10 | serial, NUL-padded ASCII |
|
||||||
|
| 34 | 254 | text, NUL-padded |
|
||||||
|
|
||||||
|
**The text** (Blastware's, not the unit's: see below):
|
||||||
|
- **"monitoring started":** `Trigger Level : Geo: 0.0500 in/s Mic: 125.0 dB(L)`, or
|
||||||
|
`Trigger Level : Histogram`
|
||||||
|
- **an event:** `08`, then the event's time in 8 bytes (year LE), then
|
||||||
|
`Geo: 0.0500 in/s Mic: 125.0 dB(L)\rTran: 0.0500 in/s`
|
||||||
|
- **a histogram:** `08`, its time, `Histogram\r`
|
||||||
|
- **a closed session:** `Geo: 0.0500 in/s Mic: 125.0 dB(L)`
|
||||||
|
|
||||||
|
⚠ **The text is written by Blastware.** Two bench copies of the same three records
|
||||||
|
(`ach-vs-manual/BE11529.MLG`, `BE115292.MLG`) differ only in `Trigger Level: Histogram` vs
|
||||||
|
`Trigger Level : Histogram`, and so in their CRCs. A record's identity is its times, flag word
|
||||||
|
and trigger source, never its text.
|
||||||
|
|
||||||
|
#### D.4.3 The CRC ✅ solved 2026-11-09
|
||||||
|
|
||||||
|
**CRC-16/AUG-CCITT** (poly `0x1021`, init `0x1D0F`, no reflection), over `record[0:288]` (from
|
||||||
|
the length field), stored **little-endian** at `[290:292]`. It matches **3,329 / 3,329** records
|
||||||
|
(1,282 files, header records included).
|
||||||
|
|
||||||
|
It is the same rule as the Series IV setup blocks (`content[0:2]` = N, CRC over `[0:N-2]`, stored
|
||||||
|
at `[N:N+2]`) and the event footer (D.3.3), which store it big-endian.
|
||||||
|
`minimateplus/crc.py` computes it for all three.
|
||||||
|
|
||||||
|
#### D.4.4 How Blastware writes them, and how a session appears
|
||||||
|
|
||||||
|
Measured on the three DL2 units unless marked:
|
||||||
|
|
||||||
|
- **One file per call-in**, named `<serial><counter>.MLG` with nothing between, e.g.
|
||||||
|
`BE11010304.MLG`. DL2's first file has no counter (`BE8081.MLG`). The name cannot be split by
|
||||||
|
reading it; the serial inside the file is authoritative.
|
||||||
|
- **No log record appears in two call-in files.** Each holds what happened since the previous
|
||||||
|
call-in. A cable or direct download is cumulative: the bench `4-3-26-multi/BE11529.MLG`
|
||||||
|
repeats the 4-1 records.
|
||||||
|
- **A file is written 1–2 minutes after the unit stops for its call-in** ("Modem Exit"), so the
|
||||||
|
unit's clock and the PC's agree to within those minutes.
|
||||||
|
- ⚠ Through a Windows zip, file dates read an hour early from March to October (Windows
|
||||||
|
converts with the offset in force at zip time). robocopy keeps true times.
|
||||||
|
- **A Modem Exit that is not a file's last record was a call that left no file.** Example:
|
||||||
|
`BE8081321.MLG` holds Modem Exits on 2019-04-12 18:33, 04-13 07:00 and 04-15 17:15, and only
|
||||||
|
the last produced a file.
|
||||||
|
- 38 files of the 1,273 hold more than one Modem Exit.
|
||||||
|
- 🔶 Inferred: the call failed, or the PC did not take it.
|
||||||
|
- **Empty files:** BE6907 writes one or two 2–3 minutes after nearly every real call-in (230 of
|
||||||
|
its 369 files). BE12844 never does; BE8081 did once in 707 (`BE80811.MLG`, 2018-02-19). So the
|
||||||
|
231 empty DL2 files are BE6907's 230 and that one. 🔶 Inferred: the unit calls back and has
|
||||||
|
nothing new.
|
||||||
|
- **The unit's clock steps back an hour at the first call-in after daylight saving ends.** On
|
||||||
|
2026-11-01 BE12844 ran `06:00:13 → 18:45:00` (still EDT), called in at 17:46 EST, and its next
|
||||||
|
session is `17:47:25 → 18:45:00`; BE6907 likewise. 🔶 Inferred: Blastware sets the unit's clock
|
||||||
|
at the call-in.
|
||||||
|
|
||||||
|
**How a session appears:**
|
||||||
|
- **No events:** one closed record (start, stop, flag word = why it stopped).
|
||||||
|
- **With events:** a "monitoring started" record (`0xFFFF`, no stop), then one record per event
|
||||||
|
(`0x0001` + the channel).
|
||||||
|
- The unit calls in minutes after each event, and monitoring resumes as a *new* session.
|
||||||
|
- The first session's end is written nowhere; it lies between its last event's stop and the
|
||||||
|
next start.
|
||||||
|
- **A histogram:** a "monitoring started" record at T, then a histogram record from T+1 s to
|
||||||
|
the stop, carrying the stop reason (`0x0021` = Event Recorded + Modem Exit, source `0x0400`).
|
||||||
|
Waveform event records whose start falls inside it belong to that histogram session.
|
||||||
|
|
||||||
|
**Cross-check (2026-11-13, `scratch/check_mlg_vs_events.py`):** each Event Recorded record was
|
||||||
|
matched to a DL2 event file by stop time + flag word + trigger source.
|
||||||
|
- **BE8081:** 785 / 785 records match a file, and every one of its 785 event files in that period
|
||||||
|
has its record.
|
||||||
|
- **BE6907 and BE12844:** all 25 event files have a record. The 42 records with no file all stop
|
||||||
|
after 2026-08-25, where the DL2 copy ends.
|
||||||
|
- **The footer CRCs:** all 4,303 of those three units' event files pass (D.3.3).
|
||||||
|
|
||||||
|
> ⚠ **RETRACTED 2026-11-13: D.4.1–D.4.3 below (the old reading).** The 308-byte header, the CRC
|
||||||
|
> at `record[0:2]`, the big-endian times, the 4-byte "record flags" table and the unknown CRC are
|
||||||
|
> all superseded by the sections above. They are kept as history, per this document's convention.
|
||||||
|
> The 2026-11-09 note inside them (little-endian, the flag word) was the first step of the new
|
||||||
|
> reading.
|
||||||
|
|
||||||
|
#### D.4.1 (retracted) MLG Header (308 bytes)
|
||||||
|
|
||||||
| Offset | Length | Field | Notes |
|
| Offset | Length | Field | Notes |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
@@ -3479,7 +3641,7 @@ The footer terminates the N00 file. Its bytes come directly from the terminator
|
|||||||
| 0x2A | 8 | serial number | null-padded ASCII (e.g. `"BE11529"`) |
|
| 0x2A | 8 | serial number | null-padded ASCII (e.g. `"BE11529"`) |
|
||||||
| 0x32 | remainder | zero pad | pads to 308 bytes total |
|
| 0x32 | remainder | zero pad | pads to 308 bytes total |
|
||||||
|
|
||||||
#### D.4.2 MLG Record (292 bytes each)
|
#### D.4.2 (retracted) MLG Record (292 bytes each)
|
||||||
|
|
||||||
| Offset | Length | Field | Notes |
|
| Offset | Length | Field | Notes |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
@@ -3500,6 +3662,24 @@ The footer terminates the N00 file. Its bytes come directly from the terminator
|
|||||||
| `01 00 02 00` | Triggered event (has ts1 + ts2) |
|
| `01 00 02 00` | Triggered event (has ts1 + ts2) |
|
||||||
| `02 00 00 00` | Monitoring interval (has ts1 + ts2) |
|
| `02 00 00 00` | Monitoring interval (has ts1 + ts2) |
|
||||||
|
|
||||||
|
> 🔑 **2026-11-09 (measured on the 4 bench `.MLG` files):** these flags are the event footer's
|
||||||
|
> flag word and trigger source (D.3.3, D.6.14), stored **little-endian**. The record's
|
||||||
|
> `[22:24]` is the monitor-log flag word, `[24:26]` the trigger source; ts1 and ts2 have the
|
||||||
|
> year little-endian too (D.2). So:
|
||||||
|
> - `01 00 02 00` = `0x0001` Event Recorded, triggered by `0x0002` Vert, not a fixed "event" code.
|
||||||
|
> - `02 00 00 00` = `0x0002` Keyboard Exit.
|
||||||
|
> - `04 00 00 00` = `0x0004` Remote Exit. SFM's own remote stops on BE11529 show up this way.
|
||||||
|
> - `03 00 00 04` / `05 00 00 04` = Event Recorded + Keyboard / Remote Exit, source `0x0400`, a
|
||||||
|
> histogram.
|
||||||
|
> - `01 08 02 00` = `0x0801` Event Recorded + Memory Full Exit, source Vert (BE9441, 10-26).
|
||||||
|
> - `ff ff` = monitoring started, no stop yet.
|
||||||
|
>
|
||||||
|
> BE9441's 10-25 session (44 records) lines up with that session's 20 event files: each Event
|
||||||
|
> Recorded record's stop equals the event footer's stop and its flag word, 20 / 20. Blastware's
|
||||||
|
> words for each bit are D.6.14's table.
|
||||||
|
> ⚠ `write_mlg()` (`blastware_file.py`) writes timestamps big-endian, unlike Blastware's own
|
||||||
|
> files; nothing calls it today.
|
||||||
|
|
||||||
**Text content for triggered events (`flags = 01 00 02 00`):**
|
**Text content for triggered events (`flags = 01 00 02 00`):**
|
||||||
|
|
||||||
| Byte | Field |
|
| Byte | Field |
|
||||||
@@ -3508,7 +3688,10 @@ The footer terminates the N00 file. Its bytes come directly from the terminator
|
|||||||
| 1–8 | ts1 copy (8B big-endian) |
|
| 1–8 | ts1 copy (8B big-endian) |
|
||||||
| 9+ | `"Geo: X.XXX in/s\x00"` ASCII geo threshold |
|
| 9+ | `"Geo: X.XXX in/s\x00"` ASCII geo threshold |
|
||||||
|
|
||||||
#### D.4.3 MLG CRC
|
#### D.4.3 (retracted) MLG CRC
|
||||||
|
|
||||||
|
> ⚠ **Solved 2026-11-09:** CRC-16/AUG-CCITT over the record from its length field, at the record's
|
||||||
|
> end (the new D.4.3 above). Every attempt below looked for it at the record's start.
|
||||||
|
|
||||||
The 2-byte CRC at record[0:2] uses an unconfirmed algorithm. Tested against CRC-16/CCITT, CRC-16/IBM, CRC-32 (truncated), word sums, XOR variants, and 40+ polynomial/init combinations — none matched. The writer emits `00 00`. Blastware may reject files with incorrect CRCs (impact on import unknown — TODO: test).
|
The 2-byte CRC at record[0:2] uses an unconfirmed algorithm. Tested against CRC-16/CCITT, CRC-16/IBM, CRC-32 (truncated), word sums, XOR variants, and 40+ polynomial/init combinations — none matched. The writer emits `00 00`. Blastware may reject files with incorrect CRCs (impact on import unknown — TODO: test).
|
||||||
|
|
||||||
@@ -3637,6 +3820,22 @@ Each field was proven by the decode checker, `scratch/check_s3_decode.py`. It co
|
|||||||
decode with Blastware's `_XML.XML` report for every DL2 event: 70,042 events, 2016–2026, local
|
decode with Blastware's `_XML.XML` report for every DL2 event: 70,042 events, 2016–2026, local
|
||||||
copy in `~/dl2-archive`. Counts below are from that archive unless stated otherwise.
|
copy in `~/dl2-archive`. Counts below are from that archive unless stated otherwise.
|
||||||
|
|
||||||
|
> 🔑 **Reading a mismatch: 256, 4,096 and 65,536 mean a number outgrew its box** (Brian,
|
||||||
|
> 2026-11-05). These are 2⁸, 2¹² and 2¹⁶: how many values an 8-, 12- or 16-bit field can hold.
|
||||||
|
> When a value is off by exactly one of them, or stops at one, suspect the storage, not the
|
||||||
|
> physics. Every case so far:
|
||||||
|
>
|
||||||
|
> | Seen as | Box | Cause |
|
||||||
|
> |---|---|---|
|
||||||
|
> | O117I1NK's samples off by 65,536 counts at the trigger, the mic's by 4,096 (D.6.12) | 16-bit sample (12-bit mic) | the unit wrote a value beyond the range; it rolled over |
|
||||||
|
> | the unit's largest step stored × 65,536 (D.6.12) | 16.16 fixed point | whole part in the top 16 bits, fraction in the bottom 16 |
|
||||||
|
> | histogram PVS² high word non-zero above 1.28 in/s (D.6.5) | 16-bit half of a uint32 | 1.28 in/s = 256 units, and 256² = 65,536 |
|
||||||
|
> | histogram peaks clipped at 1.275 in/s until 2026-08-25 | one byte read where the value is 16-bit | 255 units is the most a byte holds |
|
||||||
|
> | the 5A walk failing past 64 KB until 2026-10-26 (§7.8) | 16-bit address | addresses roll over every 65,536 bytes |
|
||||||
|
>
|
||||||
|
> The geophone's full scale is 32,000 counts, deliberately short of the 16-bit limit (32,767):
|
||||||
|
> that one is a design margin, not an overflow.
|
||||||
|
|
||||||
#### D.6.1 Record type — `STRT[18]` ✅
|
#### D.6.1 Record type — `STRT[18]` ✅
|
||||||
|
|
||||||
| `STRT[18]` | Type | DL2 |
|
| `STRT[18]` | Type | DL2 |
|
||||||
@@ -3799,28 +3998,382 @@ Each interval stores its peak vector sum **squared**:
|
|||||||
- **Verified:** interval psi mismatches fell from 42,783 to 26, and mic peak mismatches from 345
|
- **Verified:** interval psi mismatches fell from 42,783 to 26, and mic peak mismatches from 345
|
||||||
to 40.
|
to 40.
|
||||||
|
|
||||||
#### D.6.7 Not read from the file yet
|
> ⚠ **CORRECTED 2026-11-09 (measured): the offset is 81.938216, and [81.9383, 81.9385] was too
|
||||||
|
> high.** Every count Blastware printed in DL2 leaves **[81.9382058, 81.9382266]**:
|
||||||
|
> - 1,704 distinct counts in waveform sample tables, 520 in histogram intervals and 494
|
||||||
|
> histogram peaks;
|
||||||
|
> - count 129 (124.2) bounds the offset from below, 463 (135.2; 81.9384 prints 135.3) and 677
|
||||||
|
> (138.5) from above.
|
||||||
|
>
|
||||||
|
> No count prints two ways once the cases below are set aside, so one offset serves every
|
||||||
|
> printing path. The physical 81.93820 misses only count 129.
|
||||||
|
|
||||||
*Updated 2026-11-03. 18 of 88 report fields now match on every DL2 event.*
|
**The mic has its own range** (2026-11-09, measured). Its channel block carries a range byte at
|
||||||
|
the geophones' offset, label + 29 (D.6.4). At `1` each count is an eighth: 0.25 / 8 Pa.
|
||||||
|
- It is set on 7 DL2 events, all of them Blastware's values ÷ 8 (K557J1XQ.GF0W: 79.4 dB(L), not
|
||||||
|
97.5). It is set on none of the other 70,026.
|
||||||
|
- It is independent of the geophone range: 28 events have Sensitive geophones and a range-0 mic.
|
||||||
|
- SFM read those 7 mics 8× high until 2026-11-09.
|
||||||
|
|
||||||
|
**Blastware's mic unit labels do not hold on every report** (2026-11-09, measured). The decode
|
||||||
|
checker reads each value in the unit actually printed:
|
||||||
|
- **The peak carries its own `<Units>`.** 7 reports set it to dB under a psi Units line, 3 the
|
||||||
|
reverse; on 2 of those (K888HLJ1.UP0H, S353LADC.OE0H) the peak's own label is the wrong one.
|
||||||
|
- **A sample table has no unit of its own and need not follow the line.** S353JTHU.DT0W prints
|
||||||
|
dB under psi on both. Its cells say which: a mic dB value is never under 60, psi never over 1.
|
||||||
|
- **Some reports mix the two inside one column.** K441L9IN.OT0W prints psi `0.000` for counts of
|
||||||
|
1 to 3 in a dB table; S353JTHU.DT0W psi rows, then dB rows. A histogram row can print one unit
|
||||||
|
in both mic columns: I145HKWT.DY0H row 672 reads 95.92 under psi(L) and dB(L).
|
||||||
|
- The checker's `mic-units-mixed` carve-out accepts such a field when every cell SFM disagrees
|
||||||
|
with is SFM's own value in the other unit. A cell matching neither is still a mismatch.
|
||||||
|
|
||||||
|
**Three things share the word "units". Keep them apart** (2026-11-03):
|
||||||
|
|
||||||
|
| Name | What it is | Its units are set by | Where it shows |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Recorded data** | the mic samples and interval peaks in the event file | nothing: they are raw counts | the event file |
|
||||||
|
| **Report units** | dB(L) or psi(L) in a report | Blastware's report: the PC's preference (Blastware manual 714U0301 Rev 22 §4, Preferences → Units and Channel). SFM's report: SFM's own fixed choice (PDF PSPL in dB(L), plot in psi) | a Blastware report, an SFM report |
|
||||||
|
| **Unit peaks** | the peaks the unit works out for its own summary | the unit's Microphone Units setting: psi(L), dB(L) or Pa(L), on the keypad (Right Arrow + Setups) or from Compliance Setup → Special Setups (MiniMate Plus manual 716U0101 Rev 15 §3.9.7) | the unit's screen, Blastware's event list, the 0C record on a live download |
|
||||||
|
|
||||||
|
- A Blastware report converts the recorded counts in its PC's preference. That is why DL2's
|
||||||
|
reports flip dB ↔ psi fleet-wide, in 61 clean runs by report-write time. The decode checker's
|
||||||
|
`units-is-a-display-preference` carve-out covers it.
|
||||||
|
- 🔶 **Where the unit stores its own setting, and its unit peaks, is not measured.** Blastware's
|
||||||
|
event list must read the unit peaks from somewhere, so they are probably in the event file,
|
||||||
|
perhaps near the embedded event record.
|
||||||
|
- **To settle it (proposed, not done):** on a bench unit, change Microphone Units on the keypad,
|
||||||
|
then diff a read-only `1A` read and a short recorded event.
|
||||||
|
|
||||||
|
#### D.6.8 Identity, battery and trigger ✅ 2026-11-03
|
||||||
|
|
||||||
|
**The identity block** sits before the setup name. It is what the live read gets from SUB FE
|
||||||
|
(`DeviceInfo`); offsets are from `k`:
|
||||||
|
|
||||||
|
| Offset | Content | DL2 |
|
||||||
|
|---|---|---|
|
||||||
|
| `k − 202` | serial number, NUL-terminated | 70,042 / 70,042 |
|
||||||
|
| `k − 193` | firmware minor (`0x11` = 17), as SUB EA | — |
|
||||||
|
| `k − 190` | battery, uint16 BE, hundredths of a volt | 70,042 / 70,042 (Blastware rounds half up: 6.25 → "6.3 Volts") |
|
||||||
|
| `k − 147` | firmware, `"S338.17"` | |
|
||||||
|
| `k − 138` | DSP version, `"10.72"` | Version 70,042 / 70,042 as `V {DSP}-{firmware after "S33"} {model}`; only `10.72-8.17` occurs, so the rule is proven for that alone |
|
||||||
|
| `k − 132` | calibration date, `dd mm yyyy` (BE year) | Calibration 70,042 / 70,042 as `{Month} {d}, {yyyy} by {k − 128}` |
|
||||||
|
| `k − 128` | calibrated by, `"Instantel"` | |
|
||||||
|
| `k − 94` | manufacturer, `"Instantel"` | |
|
||||||
|
| `k − 72` | model, `"MiniMate Plus"` / `"BlastMate III"` | |
|
||||||
|
|
||||||
|
- `k − 180 … k − 149` hold eight float32s (1.0, 8.0, then 1.0s). Not identified.
|
||||||
|
- 🔶 **Inferred, not measured:** the three bytes before the serial are `9c 06 00`. With the
|
||||||
|
serial's `B` (0x42) that makes `9c 06 00 42`, the histogram codec's "terminal tail". It looks
|
||||||
|
like the start of this record rather than the end of a block. Every serial starts with B
|
||||||
|
(BE… / BA…).
|
||||||
|
|
||||||
|
**The trigger source** is in the embedded event record (§7.8.9). The two bytes between its lead
|
||||||
|
`00 28 05 00` and `fe 80`, a uint16 BE bitmask, were "unknown" until now:
|
||||||
|
|
||||||
|
| Value | Blastware's Trigger |
|
||||||
|
|---|---|
|
||||||
|
| `0x0001` | Tran |
|
||||||
|
| `0x0002` | Vert |
|
||||||
|
| `0x0004` | Long |
|
||||||
|
| `0x0008` | MicL |
|
||||||
|
| `0x0200` | Manual |
|
||||||
|
|
||||||
|
That holds on 6,524 / 6,524 waveforms.
|
||||||
|
|
||||||
|
**Trigger settings,** in Series IV's `0x1A` layout:
|
||||||
|
|
||||||
|
| Offset | Content | DL2 |
|
||||||
|
|---|---|---|
|
||||||
|
| `k − 19` | trigger sources: `0x07` geophones, `0x08` mic (`0x80` seen once, not identified) | — |
|
||||||
|
| `k − 23` | active sensors, `0x0f` (all four) | 69,975, `0x07` on 8 mic-less files |
|
||||||
|
| `k − 31` | stop mode: 0 = Fixed | 6,524 / 6,524, the only value in DL2 |
|
||||||
|
| channel label + 30 | float32 trigger level: geophones in/s, mic psi | geo 6,484 / 6,484, mic 4,412 / 4,412 |
|
||||||
|
| MicL + 4 | mic type code: 2 = Linear Weighting, as Series IV | 70,034 / 70,034, the only value |
|
||||||
|
|
||||||
|
- **Blastware prints a trigger level only when its channel is a trigger source** and the event
|
||||||
|
was not Manual.
|
||||||
|
- **For the mic level in dB, Blastware converts with 6895 Pa per psi.** That gives 4,272 / 4,272;
|
||||||
|
the exact 6894.757 gives 4,271, failing one boundary case (0.01 psi → "130.8 dB(L)").
|
||||||
|
- **The file's channel block is the 1A's, 4 bytes earlier.** Compare the 1A's scale constant at
|
||||||
|
+28 and range at +33 with the file's +24 and +29.
|
||||||
|
|
||||||
|
#### D.6.9 Histogram interval detail ✅ 2026-11-03
|
||||||
|
|
||||||
|
**Interval size** is a uint16 count of seconds at `k − 40` (Series IV `[8:10]`): 2, 5, 15, 60 or
|
||||||
|
300. It matches Blastware's IntervalSize ("1 minute", "5 seconds", …) on 63,518 / 63,518 DL2
|
||||||
|
histograms. **The stop** is the footer's ts2: 63,460 / 63,518. The other 58 are Blastware a
|
||||||
|
second earlier, the #51 family.
|
||||||
|
|
||||||
|
**Each interval's frequency** comes from its half-period in samples:
|
||||||
|
`frequency = (sample rate / 2) / half-period`. That matches 527,915 / 527,915 printed cells at
|
||||||
|
1024 sps and 1,725 / 1,725 at 2048.
|
||||||
|
- ⚠ **RETRACTED (#50):** "frequency = 512 / half-period". 512 is half the sample rate at
|
||||||
|
1024 sps only; at 2048 sps it halved every frequency.
|
||||||
|
|
||||||
|
Blastware prints these words instead of a number, on ~3.1 M DL2 cells:
|
||||||
|
|
||||||
|
| half-period / frequency | printed |
|
||||||
|
|---|---|
|
||||||
|
| half-period 0 | `N/A` |
|
||||||
|
| half-period ≤ 5 samples | `>100` at 1024 sps, `>200` at 2048 |
|
||||||
|
| below 1 Hz | `<1.0` |
|
||||||
|
| below 10 Hz (20 at 2048) | one decimal |
|
||||||
|
| otherwise | a whole number |
|
||||||
|
|
||||||
|
All four channels match every DL2 histogram.
|
||||||
|
|
||||||
|
**Each interval's vector sum** is √PVS² (D.6.5) at the event's range: 63,497 histograms match.
|
||||||
|
- Blastware prints `OORANGE` for an interval's vector sum above the range when it also clamped
|
||||||
|
a channel in that interval: 17 / 17 cells. The decode checker's saturation carve-out covers
|
||||||
|
it.
|
||||||
|
- 4 cells sit about 4e-6 past a rounding boundary. Blastware's arithmetic is a hair lower; they
|
||||||
|
stay counted as mismatches.
|
||||||
|
|
||||||
|
#### D.6.10 Histogram timing — the histogram's own event record ✅ 2026-11-03 (#51)
|
||||||
|
|
||||||
|
**A histogram carries an embedded event record like a waveform's** (§7.8.9):
|
||||||
|
|
||||||
|
00 28 05 00 04 00 fe f5 [start 8 B] [stop 8 B]
|
||||||
|
lead source marker dd mm yyyy 00 hh mm ss (as the footer)
|
||||||
|
|
||||||
|
- **Source `04 00`** sits where a waveform's trigger-source bitmask goes (D.6.8).
|
||||||
|
- **The start is Blastware's Histogram Start Time** on 63,490 / 63,490 DL2 histograms, and the
|
||||||
|
stop is its Stop Time on 63,490 / 63,490.
|
||||||
|
- On all 63,500 there is exactly one such record. Its start is 0 or 1 s after the footer's ts1
|
||||||
|
(1 s on 61,645), and its stop 0 or 1 s before the footer's ts2 (1 s on 57).
|
||||||
|
- That makes the footer's start a second early on 97%. #51 had read it as SFM's error; it is
|
||||||
|
the footer's own convention.
|
||||||
|
|
||||||
|
**What follows from the start:**
|
||||||
|
|
||||||
|
| Field | Blastware's rule | DL2 sample |
|
||||||
|
|---|---|---|
|
||||||
|
| Each interval's printed time | its end: start + (i + 1) × interval, capped at the stop | 2,308,524 / 2,308,524 rows |
|
||||||
|
| Each peak's date and time (Tran, Vert, Long, vector sum, mic) | those of the interval holding its first maximum | 2,000 / 2,000 each |
|
||||||
|
|
||||||
|
> ⚠ **RETRACTED 2026-11-03:** "histograms stay on ts1". That held only while SFM's events
|
||||||
|
> table was unique on (serial, timestamp). A waveform and its histogram share a second in
|
||||||
|
> Blastware's timing (209 times in prod's 2026-09-30 store). SFM's events are now keyed on
|
||||||
|
> unit + time + type.
|
||||||
|
|
||||||
|
#### D.6.11 Not read from the file yet
|
||||||
|
|
||||||
|
*Updated 2026-11-09. 80 of 88 report fields now match on every DL2 event: 47 before group D,
|
||||||
|
59 after it, 71 with the sensor check, 72 with the monitor log, 80 with over range and the mic
|
||||||
|
(run `20261109-144544`, 0 regressions). Every other field matches or is accepted under a
|
||||||
|
carve-out with its evidence. What is left is 16 values in two causes, below: the vector sum's
|
||||||
|
last digit on 4 twins, and 4 accelerations.*
|
||||||
- **Fields not read yet:**
|
- **Fields not read yet:**
|
||||||
- trigger source and levels, stop mode, mic type, display units, firmware version, serial
|
|
||||||
number, calibration, battery
|
|
||||||
- per-interval frequencies (#50: they assume 1024 sps), per-interval PVS, interval size,
|
|
||||||
histogram stop time
|
|
||||||
- extended notes
|
- extended notes
|
||||||
- the values Blastware computes: ZC frequency, acceleration, displacement, time of peak
|
- ~~sensor check results~~ **read, 2026-11-06 (D.6.13)**: the unit's own, in the header of
|
||||||
- sensor check results
|
each sensor-check record
|
||||||
- monitor log
|
- ~~monitor log~~ **read, 2026-11-08 (D.6.14)**: the footer's times and flag word
|
||||||
|
- ~~the values Blastware computes: ZC frequency, acceleration, displacement, time of peak~~
|
||||||
|
**Read, 2026-11-04 → 05 (D.6.12).** Blastware prints the unit's own ZC frequency,
|
||||||
|
displacement and time of peak, all stored in the file. Acceleration is the exception:
|
||||||
|
the unit stores its own, but Blastware prints its own computation from the samples.
|
||||||
- **Open cases:**
|
- **Open cases:**
|
||||||
- histogram start times are 1 s early (#51)
|
- ~~about 20 one-minute histograms with a mic peak an interval or two off~~ **explained
|
||||||
- about 20 one-minute histograms with a mic peak an interval or two off
|
2026-11-09 (D.6.6):** Blastware printed one unit in both mic columns of that row.
|
||||||
- Blastware prints `OORANGE` when the vector sum alone exceeds the range (a carve-out still to
|
- ~~Blastware prints `OORANGE` when an event's vector sum alone exceeds the range~~
|
||||||
prove)
|
**refuted 2026-11-09 (D.6.15):** it never does; the vector sum is `OORANGE` exactly when a
|
||||||
|
geophone is over range.
|
||||||
|
- **The vector sum's last digit on 4 waveform/histogram twins** (8 events: K888KLSU,
|
||||||
|
N599HVPW, O121L4L1, S354KD9N). Each true value sits a few parts in 10⁷ above a rounding
|
||||||
|
edge, and Blastware rounds down. A factor of 0.9999983–0.9999989 fits all 69,940 printed
|
||||||
|
vector sums; the acceleration's 8.5 ppm does not (69,918). Cause unknown; SFM does not
|
||||||
|
apply a factor. **Decided (Brian, 2026-11-11): left as is and documented** -- a fitted
|
||||||
|
factor on a compliance number is not worth one last digit on 8 events.
|
||||||
|
- **4 accelerations** (D.6.12): O117I1NK.R70W ×3 and S353I5PZ.EP0W Vert. **Decided (Brian,
|
||||||
|
2026-11-11): left as is and documented** -- O117I1NK's fit rests on one clipped file.
|
||||||
- **Resolved on `dev`, 2026-11-02 → 03:**
|
- **Resolved on `dev`, 2026-11-02 → 03:**
|
||||||
- the 37 histograms that decoded wrongly (D.6.1, D.6.5)
|
- the 37 histograms that decoded wrongly (D.6.1, D.6.5)
|
||||||
- the 26 histogram start dates a day off (D.3.3; 17 of them were the same 5 s files, timed
|
- the 26 histogram start dates a day off (D.3.3; 17 of them were the same 5 s files, timed
|
||||||
as waveforms)
|
as waveforms)
|
||||||
- the job number (D.6.3)
|
- the job number (D.6.3)
|
||||||
|
- identity, battery, trigger source and trigger settings (D.6.8); Units is Blastware's
|
||||||
|
preference (D.6.6)
|
||||||
|
- histogram interval detail: frequencies (#50), vector sums, interval size, stop (D.6.9)
|
||||||
|
- histogram start, stop, interval and peak times (#51, D.6.10)
|
||||||
|
|
||||||
|
#### D.6.12 Peak detail — the unit's own event summary ✅ 2026-11-05
|
||||||
|
|
||||||
|
**The embedded event record (§7.8.9, D.6.10) is the first of a chain** of
|
||||||
|
`[length uint16 BE][id][payload]` records: the next one starts `length + 2` bytes after a
|
||||||
|
record's lead. `00 28 05` is length 40 and id `0x05`. Measured on the 6,493 DL2 waveforms and
|
||||||
|
63,500 histograms that have a Blastware report.
|
||||||
|
|
||||||
|
**The event record**, offsets from its marker `M` as in §7.8.9:
|
||||||
|
|
||||||
|
| bytes | content |
|
||||||
|
|---|---|
|
||||||
|
| `[M+22:M+26]` | the vector-sum peak's sample, uint32 BE: SFM's own vector-sum peak on 6,492 / 6,493 (the other is O117I1NK, below) |
|
||||||
|
| `[M+18:M+22]`, `[M+26:M+36]` | not identified ❓ |
|
||||||
|
|
||||||
|
**Then one record per channel**, length 22: ids `0x32` Tran, `0x33` Vert, `0x34` Long,
|
||||||
|
`0x35` MicL. A unit without a mic has no `0x35` (6 DL2 files).
|
||||||
|
|
||||||
|
| payload | content |
|
||||||
|
|---|---|
|
||||||
|
| `[0]` | `00` on all 25,966 waveform channels |
|
||||||
|
| `[1:3]` | min, int16 BE: geophones in decoder units of 16 counts (0.005 in/s at Normal), the mic in counts |
|
||||||
|
| `[3:5]` | max, the same |
|
||||||
|
| `[5:9]` | the peak's sample, uint32 BE |
|
||||||
|
| `[9:11]` | **half-period**, samples, uint16 BE |
|
||||||
|
| `[11:15]` | **displacement integral**, uint32 BE, in units × samples |
|
||||||
|
| `[15:21]` | 🔶 **the unit's own largest sample-to-sample step**, × 65,536 (16.16 fixed point, units), read as one 48-bit BE integer. It is the stored samples' largest step plus 0 to 1 unit (median +0.5) on 19,479 geophone channels, so probably the same step at full resolution (inferred). Blastware does not print it: see peak acceleration below |
|
||||||
|
|
||||||
|
On a waveform, min, max and peak sample are the decoded samples' own on 25,962 / 25,966
|
||||||
|
channels. The 4 others are O117I1NK (below).
|
||||||
|
|
||||||
|
**Then records `0x3c` (and on a histogram `0x3d`)**, length 202–212. Not read yet. Probably
|
||||||
|
the sensor check, before and after (inferred, not measured).
|
||||||
|
|
||||||
|
> ⚠ **RETRACTED 2026-11-06 (measured):** "before and after". They are the sensor check, but
|
||||||
|
> one record per channel: `0x3c` Tran, `0x3d` Vert, `0x3e` Long, `0x3f` MicL, on waveforms and
|
||||||
|
> histograms alike. My first walk stopped at the first id it did not know. The chain runs on
|
||||||
|
> to the footer: D.6.13.
|
||||||
|
|
||||||
|
**What Blastware prints from them.** It prints the unit's values; it does not recompute them:
|
||||||
|
|
||||||
|
| Field | Rule | DL2 |
|
||||||
|
|---|---|---|
|
||||||
|
| ZC frequency, every record type | (rate / 2) / half-period. "N/A" at 0; `>100` (`>200` at 2048 sps, `>400` at 4096) at 5 samples or fewer; `<1.0` when the half-period exceeds rate / 2. The histogram interval rule (D.6.9) | waveforms 25,966 / 25,966 channel values (15,844 numbers); histograms 253,958 / 253,958 (104,000 numbers) |
|
||||||
|
| Peak displacement (waveform) | half the integral: integral × 16 counts × in/s per count (the range's, D.6.4) ÷ rate ÷ 2, in inches | 19,479 / 19,479 |
|
||||||
|
| Time of peak (waveform) | (peak sample − pre-trigger samples) ÷ rate | as the samples' own, except O117I1NK, where Blastware prints the summary's |
|
||||||
|
| Vector-sum time (waveform) | the same, from the event record's sample | 6,492 / 6,493 from the samples; O117I1NK prints the record's |
|
||||||
|
| Peak acceleration (waveform) | **Blastware's own**, from the stored samples: the largest \|v[i+1] − v[i]\| × rate ÷ g, with its g fitted to [386.2236, 386.2240] in/s² by every DL2 value (9.81 m/s² is 386.2205; the standard 9.80665 fits 17,806). The unit's own step (`[15:21]`) would match only 879 | 19,475 / 19,479 |
|
||||||
|
|
||||||
|
**Why recomputing failed.** ZC frequency recomputed from the samples matched 46% (the
|
||||||
|
half-cycle at the peak), and 80% with each crossing interpolated at ±16 counts. Displacement
|
||||||
|
matched 84% (half the largest half-cycle integral, the manuals' method). The unit works at
|
||||||
|
full resolution: a stored sample of ±16 counts hides anything from 1 to 31.
|
||||||
|
|
||||||
|
**O117I1NK.R70W (2019): clipped, and its samples wrap.**
|
||||||
|
- **The wrap:** at the trigger (sample 254), every stored sample is off by exactly 65,536
|
||||||
|
counts (4,096 on the mic). Tran reads +26,832 where the summary's min is −38,704 (−12.1 in/s).
|
||||||
|
- **Blastware decodes the same:** its own sample table has the same wrapped values (Tran
|
||||||
|
8.385 in/s).
|
||||||
|
- **It prints the summary:** `OORANGE`, and time of peak 0.000 on all four channels and on
|
||||||
|
the vector sum.
|
||||||
|
- **Its accelerations** equal the summary's max − min in one sample step: 48.28, 46.93 and
|
||||||
|
49.12 g, all exact. One file. Inferred: Blastware's acceleration sees the summary's extreme
|
||||||
|
at its peak sample. SFM does not do this.
|
||||||
|
|
||||||
|
**S353I5PZ.EP0W Vert (open).** Blastware's acceleration (0.027 g) skips one 80-count step,
|
||||||
|
from sample 4,096 to 4,097, which its own sample table shows. Not explained. Skipping every
|
||||||
|
4,096-sample boundary fixes this file but breaks another.
|
||||||
|
|
||||||
|
#### D.6.13 The record chain to the footer, and the sensor check ✅ 2026-11-06
|
||||||
|
|
||||||
|
**The whole tail of an event file is one record chain.** Walked from the event record by its
|
||||||
|
length prefixes, it ends exactly at the file's last byte on **all 70,041 DL2 files**, in two
|
||||||
|
shapes:
|
||||||
|
|
||||||
|
| Files | Chain |
|
||||||
|
|---|---|
|
||||||
|
| 70,033 | `0x05` event record → `0x32`–`0x35` unit's summary (D.6.12) → `0x3c`–`0x3f` sensor checks → `0x0e` footer |
|
||||||
|
| 8 | the same without `0x35` and `0x3f`: BE16352, which records no mic |
|
||||||
|
|
||||||
|
The **footer** (D.3.3, "the file's last 26 bytes") is the chain's last record: its length
|
||||||
|
`00 1a` sits just before it, and its first byte, `0e`, is its id. SFM reads nothing in the
|
||||||
|
chain unless the walk ends exactly at the end of the file.
|
||||||
|
|
||||||
|
**Each sensor-check record** (`0x3c` Tran, `0x3d` Vert, `0x3e` Long, `0x3f` MicL) holds the
|
||||||
|
check the unit ran: a header with its results, then the trace Blastware draws in its "Sensor
|
||||||
|
Check" strip (`minimateplus/sensor_check.py`, since 2026-09-15). Payload after the id:
|
||||||
|
|
||||||
|
| bytes | content |
|
||||||
|
|---|---|
|
||||||
|
| `[0:2]` | `00 00` |
|
||||||
|
| `[2]` | channel type: `01` geophone, `02` mic, `00` the check disabled |
|
||||||
|
| `[3]` | `00` |
|
||||||
|
| `[4]` | **status**: `00` passed; 1–15 otherwise |
|
||||||
|
| `[5:7]` | **frequency × 10**, uint16 BE (Hz) |
|
||||||
|
| `[7:9]` | **ratio × 10**, uint16 BE (geophones; the mic's reads 10) |
|
||||||
|
| `[9:11]` | **amplitude, mV**, uint16 BE (the mic's; geophones carry a value too, ~260–700, not printed) |
|
||||||
|
| `[11:19]` | not identified ❓ |
|
||||||
|
| `[19:]` | the trace (`sensor_check.py`'s `_HEADER_LEN` = 20 counts the id byte) |
|
||||||
|
|
||||||
|
**What Blastware prints** (`TestFreq`, `TestRatio`, `TestAmplitude`, `TestResults`):
|
||||||
|
|
||||||
|
| Field | Rule | DL2 |
|
||||||
|
|---|---|---|
|
||||||
|
| geophone test frequency and ratio | as stored, ÷ 10 | 209,943 / 209,943 each |
|
||||||
|
| mic test frequency and amplitude | as stored (frequency ÷ 10) | 69,975 / 69,975 each |
|
||||||
|
| result | `Passed` at status 0, `Check` at any other, `Disabled` at channel type 0 (and nothing else printed) | every channel |
|
||||||
|
|
||||||
|
**The status code is the unit's verdict, not a limit SFM can recompute.** Geophones that pass
|
||||||
|
span 6.7–9.4 Hz and ratio 1.9–6.0, yet K559L6N1's Tran reads `Check` at 8.1 Hz and 3.3. Each
|
||||||
|
of the four bits occurs across the whole range of frequency, ratio and amplitude, so their
|
||||||
|
meanings are not decoded. Every mic `Check` in DL2 (691) is status 13 with frequency 0 and
|
||||||
|
amplitude 0: a mic that did not respond (inferred).
|
||||||
|
|
||||||
|
#### D.6.14 The monitor log — the footer ✅ 2026-11-08
|
||||||
|
|
||||||
|
**Every DL2 report prints exactly one Monitor Log line**, built from the footer (D.3.3) alone:
|
||||||
|
|
||||||
|
<footer ts1> - <footer ts2> "<words>"
|
||||||
|
|
||||||
|
- **Start and stop:** the footer's ts1 and ts2 on 69,983 / 69,983. For a waveform ts1 is the
|
||||||
|
monitoring session's start (§7.8.9). For a histogram both are the session's.
|
||||||
|
- **The words** come from the footer's flag word `[18:20]`, uint16 BE:
|
||||||
|
|
||||||
|
| bit | words |
|
||||||
|
|---|---|
|
||||||
|
| `0x0001` | `Event Recorded ` (set on every DL2 line) |
|
||||||
|
| `0x0002` | `Keyboard Exit` |
|
||||||
|
| `0x0004` | `Remote Exit` |
|
||||||
|
| `0x0008` | `Selfcheck Passed` |
|
||||||
|
| `0x0010` | `Timer Stop` |
|
||||||
|
| `0x0020` | `Modem Exit` |
|
||||||
|
| `0x0200` | `Battery Low Exit` |
|
||||||
|
| `0x0800` | `Memory Full Exit` |
|
||||||
|
|
||||||
|
**Rule:** "Event Recorded " plus, when a session-end bit is set, one space and its words.
|
||||||
|
Rebuilt that way, the line equals Blastware's **character for character on 69,983 / 69,983**.
|
||||||
|
- One line sets Modem and Timer (`0x0031`) and prints only "Modem Exit": the higher bit wins.
|
||||||
|
That is one file, so the order of the other bits is inferred.
|
||||||
|
- Bits not seen in DL2 have no known words.
|
||||||
|
|
||||||
|
**How common each is in DL2:**
|
||||||
|
|
||||||
|
| Words | Lines |
|
||||||
|
|---|---|
|
||||||
|
| Modem Exit | 58,941 (a modem connection ended the session; a call-home, inferred from the words) |
|
||||||
|
| no session end (continuous waveforms) | 6,480 |
|
||||||
|
| Timer Stop | 4,046 |
|
||||||
|
| Keyboard Exit | 245 |
|
||||||
|
| Remote Exit | 178 |
|
||||||
|
| Battery Low Exit | 65 |
|
||||||
|
| Selfcheck Passed | 20 |
|
||||||
|
| Memory Full Exit | 8 |
|
||||||
|
|
||||||
|
SFM reads the line only when the record chain is whole (D.6.13), which proves the last 26
|
||||||
|
bytes are the footer.
|
||||||
|
|
||||||
|
#### D.6.15 Over range — Blastware's `OORANGE` ✅ 2026-11-09
|
||||||
|
|
||||||
|
**A peak is over range when it passes full scale: 2,000 units.** That is 32,000 counts on either
|
||||||
|
geophone range (16 counts to the unit), and 2,000 counts on the mic. For a channel's peak SFM uses
|
||||||
|
the unit's own summary (D.6.12), whose min and max are true values even where the stored
|
||||||
|
samples clip or wrap.
|
||||||
|
|
||||||
|
| Where | Blastware prints `OORANGE` | DL2 (2026-11-09) |
|
||||||
|
|---|---|---|
|
||||||
|
| a channel's PPV / the mic's PSPL | its summary peak passes 2,000 | numeric up to 1,991 (geophones) / 1,933 (mic), `OORANGE` from 2,001: 209,784 + 69,957 numeric, 60 + 18 over |
|
||||||
|
| the event's vector sum | **any geophone** is over | `OORANGE` on all 43 events with one, numeric on all 38 whose vector sum alone passes the range (up to 14.49 in/s) |
|
||||||
|
| the report's "Out of Range" line (`<OORANGE>`) | the **mic** is over | 18 / 18, and on no other event |
|
||||||
|
| a histogram interval's peak | that interval's peak passes 2,000 | numeric up to 1,846 / 1,414, `OORANGE` from 2,001: 8,612 + 5,744 numeric, 22 + 12 over |
|
||||||
|
| a histogram interval's vector sum | any geophone in that interval is over | 16 / 16, and numeric on all 2,862 without |
|
||||||
|
|
||||||
|
- The geophone Sensitive range does not change the threshold: Sensitive-range events read
|
||||||
|
numeric up to 88 units and `OORANGE` from 2,001.
|
||||||
|
- **Retracted in passing:** "Blastware prints `OORANGE` when the vector sum alone exceeds the
|
||||||
|
range" (D.6.11's open case). It never does.
|
||||||
|
- `PeakValues.*_over_range` carries it. The decode checker matches `OORANGE` only by that flag,
|
||||||
|
and a flag against a printed number is a mismatch. The `saturation` carve-out now accepts no
|
||||||
|
DL2 event; it stays for a file without the unit's summary.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1925,6 +1925,15 @@ at `payload[3:5]`:
|
|||||||
| 2nd | `0x0002` | 535 B | the file body |
|
| 2nd | `0x0002` | 535 B | the file body |
|
||||||
| 3rd | `0x0000` | 11 B | all zeros = **end of file** |
|
| 3rd | `0x0000` | 11 B | all zeros = **end of file** |
|
||||||
|
|
||||||
|
✅ **SFM reads the schedule this way, read-only (2026-11-03, phase 5)** --
|
||||||
|
`MicromateProtocol.read_file` / `MicromateClient.read_schedule`, frames equal to
|
||||||
|
THOR's byte for byte (`tests/test_micromate_schedule.py`). Two details the table
|
||||||
|
above leaves out: the `0x94` request carries **`params[3] = 1`**, and the **first**
|
||||||
|
`0x48` carries **`params[7] = 1`** (the later ones all-zero params); both `0x48`
|
||||||
|
offsets are `0xFFFF`. A long file is **written** in 1,024-byte `0x8E` pieces
|
||||||
|
(the five-entry *actioncheck* schedule went as 1,024 + 280). ⚠ Unmeasured: what
|
||||||
|
`0x94` / `0x48` return for a unit with no schedule file.
|
||||||
|
|
||||||
⚠ This is the single most consequential find of the session, because it is not
|
⚠ This is the single most consequential find of the session, because it is not
|
||||||
specific to the scheduler. **`callhome.MMB` is a file too**, and the call-home
|
specific to the scheduler. **`callhome.MMB` is a file too**, and the call-home
|
||||||
config is the last unsolved piece of the project. Reading it should be a
|
config is the last unsolved piece of the project. Reading it should be a
|
||||||
@@ -2736,6 +2745,39 @@ were wrong.
|
|||||||
established** — only one setting was varied. Series III's offsets are a starting
|
established** — only one setting was varied. Series III's offsets are a starting
|
||||||
hypothesis, not a transfer.
|
hypothesis, not a transfer.
|
||||||
|
|
||||||
|
#### Bench 2026-11-04: SFM's first setup push (UM20147)
|
||||||
|
|
||||||
|
SFM's audited `POST /device/settings/change`, one send per go (Brian at the
|
||||||
|
unit). Notes: `~/bench-logs/2026-11-04-sfm-settings/`.
|
||||||
|
|
||||||
|
**Measured:**
|
||||||
|
- **The setup push works as THOR's.** Trigger 0.6 → 0.5, then a five-field
|
||||||
|
change (Location, Client, job number + its report flag, record time), then a
|
||||||
|
full restore. Each send was THOR's seven frames, acknowledged in THOR's order
|
||||||
|
(`25 97 8C 7D 7C 8E 8D`), read back as sent, and confirmed in the unit's menu.
|
||||||
|
The setup block ended byte for byte as found, CRC included.
|
||||||
|
- **The unit's recomputed CRC equals SFM's** (`with_crc`): after the first push
|
||||||
|
the stored block equalled SFM's computed image byte for byte, CRC `ea8d`
|
||||||
|
included.
|
||||||
|
- **`schedule.dat` read on a real unit** (`0x94` → `0x6B`; `0x48` → descriptor
|
||||||
|
`04 00 … 01 … 01`, body, all-zero end). UM20147 holds a leftover THOR
|
||||||
|
schedule: repeat on, 07:00, start monitoring with
|
||||||
|
`Fay - Commercial Street - Irish Center.mmb`. The unit runs `test2.MMB`, so
|
||||||
|
SFM blocked the change, as designed.
|
||||||
|
- 🔑 **The scheduler On/Off switch is in none of the blocks SFM reads.** With
|
||||||
|
the keypad switch Off, then On (saved), these were byte for byte identical:
|
||||||
|
`0x08` prefs, `0x2E`, `0x1A`, `0x2C`, `0x41` and `schedule.dat`. The
|
||||||
|
firmware's `SysPref.bMonitorScheduler` lives elsewhere. THOR's end-of-push
|
||||||
|
`0x47` pair (`params[7]` 1 then 3; replies `04 00 … 0N … 00 01`) was only
|
||||||
|
ever captured with the switch On. **Next:** a THOR bridge recording with the
|
||||||
|
switch Off (parked for the work-hours project).
|
||||||
|
- **While monitoring**, a settings preview and a live attempt were both refused
|
||||||
|
on the run state before any block was read (409, nothing sent, 0 write frames).
|
||||||
|
- **With call-home off, a stop goes straight to idle** (`monitoring` →
|
||||||
|
`idle`): no calling-home state and no ring.
|
||||||
|
- Call-home `0x01` ↔ `0x00` was taken again, both ways. The plan's
|
||||||
|
"unobserved" warning is retired for those values.
|
||||||
|
|
||||||
## What the THOR manual settles about the ACH session (2026-09-24)
|
## What the THOR manual settles about the ACH session (2026-09-24)
|
||||||
|
|
||||||
Source: `manuals/723U0201 THOR Operator Manual Rev 08.pdf` §6.2, §3.6.
|
Source: `manuals/723U0201 THOR Operator Manual Rev 08.pdf` §6.2, §3.6.
|
||||||
|
|||||||
@@ -0,0 +1,525 @@
|
|||||||
|
# Phase 5: Changing a Unit's Settings by Serial — Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** An operator edits a unit's live settings in SFM, by serial, on either series: preview old → new, send once (audited), and see what the unit now holds.
|
||||||
|
|
||||||
|
**Architecture:**
|
||||||
|
- **One pure settings codec for both series** (`micromate/setup_fields.py`), on the measured shared 2,090-byte layout.
|
||||||
|
- **Each series' adapter supplies reads, the plan and the send** to the existing `run_change` core, unchanged.
|
||||||
|
- Its "state" is a read-back verdict: `as asked` / `unchanged` / `differs`.
|
||||||
|
- Series 3 sends through `push_config_raw`; Series 4 through `plan_setup_push`.
|
||||||
|
- Series 4 also reads the unit's schedule, read-only, to refuse a change that a scheduled start would undo.
|
||||||
|
- **One audited route**, `POST /device/settings/change`. The legacy by-host write is retired.
|
||||||
|
|
||||||
|
**Tech Stack:** Python 3 (FastAPI, pytest), vanilla JS tested in Node (`tests/test_webapp_device_routing.py`).
|
||||||
|
|
||||||
|
**Spec:** `docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md` (approved by Brian 2026-11-03). Parent spec: `docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md`.
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- **Worktree and branch:** work in `~/seismo-relay-parity` on `feat/series4-sfm-parity`. Check `git branch --show-current` before every commit; never commit to `main`; push every commit.
|
||||||
|
- **Python:** `/home/serversdown/seismo-relay/.venv/bin/python -m pytest …` from the worktree root.
|
||||||
|
- **The suite has 16 known failures.**
|
||||||
|
- Run the full suite once before Task 1 and save the failure list in the plan workspace as `baseline-failures.txt`.
|
||||||
|
- Before every commit, run the suite, read the failure list, and confirm it equals the baseline.
|
||||||
|
- Commit in a separate call, never chained to the test run.
|
||||||
|
- **No live device traffic** in any task. The bench is after the final review, with Brian's explicit go per send.
|
||||||
|
- Never port 8200.
|
||||||
|
- Never write modem baud or modem type.
|
||||||
|
- Never send `0xA2`.
|
||||||
|
- **`CHANGELOG.md` is not touched** on this branch; it is written on `dev` at the merge.
|
||||||
|
- **No inline JavaScript.** New page logic goes in `sfm/static/device_routing.js` (DOM-free, Node-tested); glue goes in `sfm/static/sfm_webapp.js`.
|
||||||
|
- **`docs/instantel_protocol_reference.md` is CRLF.** Edit it only with the Edit tool. Keep its rows in date order.
|
||||||
|
- **Off-limits (the checker session's files):** `minimateplus/event_file_io.py`, `histogram_codec.py`, `waveform_codec.py`, `bw_xml_report.py`, `decode_check*.py`.
|
||||||
|
- **`TOOL_VERSION` is unchanged:** nothing here changes event decoding. Operational consequence: none; no migration, no backfill.
|
||||||
|
- **Grade every protocol claim** in comments and docs as measured or inferred.
|
||||||
|
- **Mutation checks:** after a mutate/restore, delete the module's `__pycache__/*.pyc` before the confirming run.
|
||||||
|
|
||||||
|
## Review Focus
|
||||||
|
|
||||||
|
1. **A Micromate with no schedule file, or a schedule read that fails.**
|
||||||
|
- A body with no records means no conflict, and the change proceeds.
|
||||||
|
- A read that raises refuses the change in plain words.
|
||||||
|
- Owner: Task 4; tests `test_no_schedule_records_is_no_conflict` and `test_an_unreadable_schedule_refuses`.
|
||||||
|
2. **A float that is stored as f32.** 0.3 reads back as 0.30000001192.
|
||||||
|
- The verdict compares bytes with the image written, never floats, so it reads `as asked`.
|
||||||
|
- Owner: Task 2; test `test_f32_values_read_back_as_asked`.
|
||||||
|
3. **A stale or foreign revision** after a keypad edit, or a preview of another unit.
|
||||||
|
- The send is refused with 409, nothing is sent, and no audit row is written.
|
||||||
|
- Owner: Tasks 4 and 5; tests `test_s4_stale_revision_sends_nothing` and `test_s3_stale_revision_sends_nothing`.
|
||||||
|
4. **Range and trigger changed in one request.** The trigger is checked against the **new** range.
|
||||||
|
- Owner: Task 2; test `test_trigger_checked_against_the_new_range`.
|
||||||
|
5. **Notes at the edges.**
|
||||||
|
- `""` clears a note.
|
||||||
|
- 41 bytes is accepted; 42 is refused; non-ASCII is refused.
|
||||||
|
- Labels are never written.
|
||||||
|
- Owner: Task 2; tests `test_note_edges` and `test_note_labels_are_never_written`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
| file | responsibility |
|
||||||
|
|---|---|
|
||||||
|
| `minimateplus/protocol.py` | **Series 3 assembly:** `assemble_compliance_content`, `is_compliance_content`, `MiniMateProtocol.read_compliance_content`. **Writes:** `push_config_raw`'s pre-check raises `ImageRefused`. |
|
||||||
|
| `minimateplus/client.py` | **Added:** `read_compliance_content()` and `read_settings_blocks()`. **Deleted:** `apply_config`, `set_project_info`, `_encode_compliance_config`. |
|
||||||
|
| `micromate/setup_block.py` | **Added:** `with_crc(content)`. |
|
||||||
|
| `micromate/setup_fields.py` (new) | **The shared, pure settings codec:** field registry, `editable_fields`, `check_changes`, `encode_setup`, `field_values`, `settings_state`, `revision`. |
|
||||||
|
| `micromate/schedule.py` (new) | **Pure:** `parse_schedule`, `ScheduleEntry`, `schedule_conflicts`. |
|
||||||
|
| `micromate/protocol.py` | **Added:** `read_file(path)`, using `0x94` then `0x48` pages. |
|
||||||
|
| `micromate/client.py` | **Added:** `read_schedule()`, `get_active_setup_raw()`, `get_prefs_content()`, `get_trigger_content()`, `get_setup_content()`. |
|
||||||
|
| `micromate/opcodes.py` | `ENABLEABLE_WRITES` gains the setup-push SUBs. |
|
||||||
|
| `sfm/device_access/errors.py` | **Added:** `SettingsChanged` and `ChangeRefused`, both 409. |
|
||||||
|
| `sfm/device_access/change.py` | **Added:** `settings_change()`. |
|
||||||
|
| `sfm/device_access/s4.py` | `s4_settings` moves onto the codec. **Added:** `s4_change_settings`. |
|
||||||
|
| `sfm/device_access/s3.py` | `Series3Adapter.settings` moves onto the codec. **Added:** `Series3Adapter.change_settings`. |
|
||||||
|
| `sfm/device_access/access.py` | **Added:** `DeviceAccess.change_settings`. |
|
||||||
|
| `sfm/server.py` | **Added:** `POST /device/settings/change`. `/device/config` and `/device/config/project` return 410. |
|
||||||
|
| `sfm/static/device_routing.js`, `sfm/static/sfm_webapp.js`, `sfm/sfm_webapp.html` | The edit form. |
|
||||||
|
| `tests/device_access_fakes.py` | The fakes gain settings blocks, a schedule, and writes. |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: Series 3 — assemble a settings read into the logical block
|
||||||
|
|
||||||
|
**Measured basis (spec, 2026-11-03):** unescape each `1A` data frame and take `data[11:]`. Every frame but the last starts with one non-content `00` byte; drop it. The result is 2,090 bytes with `N = 2090` at `[0:2]`.
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `minimateplus/protocol.py`, near `read_compliance_config` (≈ line 913)
|
||||||
|
- Modify: `minimateplus/client.py`
|
||||||
|
- Modify: `docs/instantel_protocol_reference.md` (one dated row, 2026-11-03)
|
||||||
|
- Test: `tests/test_s3_settings_read.py` (new)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces:
|
||||||
|
- `assemble_compliance_content(frames: list[bytes]) -> bytes`. `frames` is each data reply's `frame.data`, escapes kept, in order.
|
||||||
|
- `is_compliance_content(block: bytes) -> bool`: `len == 2090` and `int.from_bytes(block[0:2], "big") == 2090`.
|
||||||
|
- `COMPLIANCE_CONTENT_LEN = 2090`.
|
||||||
|
- `MiniMateProtocol.read_compliance_content() -> bytes`:
|
||||||
|
- sends the same probe and B/C/D requests as `read_compliance_config`;
|
||||||
|
- a missing data frame raises `ProtocolError` (no `continue`);
|
||||||
|
- returns the assembled bytes **without** judging them, so a monitoring unit's device-info answer comes back for the caller to recognise.
|
||||||
|
- `MiniMateClient.read_compliance_content() -> bytes`.
|
||||||
|
- `MiniMateClient.read_settings_blocks() -> dict` with keys `event_index`, `compliance`, `trigger` and `waveform`. Each value is the bytes its existing read returns:
|
||||||
|
- `event_index`: `proto.read_event_index()`
|
||||||
|
- `compliance`: `read_compliance_content()`
|
||||||
|
- `trigger`: `proto.read_trigger_config()`
|
||||||
|
- `waveform`: `proto.read_waveform_data_raw()`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests** in `tests/test_s3_settings_read.py`. Use `tests/fixtures/minimate-bench-10-26-26-histogram` (`unit_replies.bin` parsed with `S3FrameParser`). Group the `0xE5` frames into reads: a frame with `len(data) == 11` starts each read. Take the write images from `tests/test_minimate_write_frames.py` (`WRITES[0:13]`, `WRITES[13:26]`; the `0x71` payloads `[16:]` joined).
|
||||||
|
|
||||||
|
```python
|
||||||
|
def test_reads_assemble_to_2090_bytes(): # all 12 reads, both frame patterns (5 and 3 frames)
|
||||||
|
assert all(len(assemble_compliance_content(r)) == 2090 for r in READS)
|
||||||
|
|
||||||
|
def test_a_read_after_a_blastware_write_equals_the_write():
|
||||||
|
assert assemble_compliance_content(READS[1]) == IMAGES[0][:2090]
|
||||||
|
assert assemble_compliance_content(READS[2]) == IMAGES[1][:2090]
|
||||||
|
|
||||||
|
def test_a_monitoring_units_answer_is_not_settings(): # READS[3:8] start 0e 'BE9441'
|
||||||
|
assert [is_compliance_content(assemble_compliance_content(r)) for r in READS[3:8]] == [False] * 5
|
||||||
|
assert all(is_compliance_content(assemble_compliance_content(r)) for r in READS[:3] + READS[8:])
|
||||||
|
|
||||||
|
def test_read_compliance_content_refuses_a_missing_frame():
|
||||||
|
... # a fake transport that answers the probe and frame B, then times out: ProtocolError, nothing assembled
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them.** `…pytest tests/test_s3_settings_read.py -q`. Expected: FAIL (ImportError: `assemble_compliance_content`).
|
||||||
|
- [ ] **Step 3: Implement** the Produces block in `protocol.py` and `client.py`. Use `unescape_reply` from `minimateplus.framing`. The docstring cites the measurement and its fixture.
|
||||||
|
- [ ] **Step 4: Run them.** Expected: PASS (4 passed).
|
||||||
|
- [ ] **Step 5: Add a reference row** to `docs/instantel_protocol_reference.md` (Edit tool; CRLF), dated 2026-11-03, measured. Cover:
|
||||||
|
- the assembly rule;
|
||||||
|
- the round trip (2 of 2);
|
||||||
|
- `[26:28]`: Blastware writes `00 00` (11 of 11), and the unit sets `01 7f` after monitoring;
|
||||||
|
- the trailing two bytes: a per-unit Blastware constant (`7c ea` BE11529 ×9, `0c e9` BE9441 ×2), not the CRC, and never in a reply;
|
||||||
|
- `0x09 [200:202]`: echoed 9 of 9 in April; changed on 10-26 (`17 17` → `78 76`).
|
||||||
|
- [ ] **Step 6: Run the full suite** and compare the failure list with the baseline. **Then commit** (separate call): `feat(s3): assemble a settings read into the 2,090-byte block`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 2: The shared settings codec
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `micromate/setup_fields.py`
|
||||||
|
- Modify: `micromate/setup_block.py`: add `with_crc(content: bytes) -> bytes`, which returns the content with `CRC-16/AUG-CCITT` over `[0:N-2]` written BE at `[N:N+2]`.
|
||||||
|
- Test: `tests/test_setup_fields.py` (new)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: Task 1's `assemble_compliance_content`, used in tests only. The codec itself imports nothing from `minimateplus` and nothing from `sfm`.
|
||||||
|
- 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, 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;
|
||||||
|
- bit fields are patched bit by bit;
|
||||||
|
- Series 3 also sets `[26:28] = 00 00` (`S3_BLASTWARE_FIXED`);
|
||||||
|
- Series 4 returns `with_crc(...)`.
|
||||||
|
- `settings_state(before: bytes, written: bytes, now: bytes, *, series: int) -> str`. It compares `[0:2090]`:
|
||||||
|
- `"as asked"` if `now` equals `written` (Series 4 also needs `crc_ok(now)`);
|
||||||
|
- else `"unchanged"` if `now` equals `before`;
|
||||||
|
- else `"differs"`.
|
||||||
|
- `revision(blocks: list[bytes]) -> str` = `hashlib.sha256(b"".join(blocks)).hexdigest()[:16]`.
|
||||||
|
- `S3_ALARM_WRITE_MEASURED = False`. While False, `geo_alarm_ips` is shown (read-only, `kind` plus `"readonly": True`) and refused in `check_changes`.
|
||||||
|
|
||||||
|
**The field registry** (content offsets; channel `k` = `1708 + 48·k`, `k` = 0, 1, 2 for the geophones):
|
||||||
|
|
||||||
|
| field | series | bytes | values (exact) |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `record_mode` | 3 | `[5]` | `single_shot`=0, `continuous`=1, `histogram`=3, `histogram_continuous`=4 |
|
||||||
|
| `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 | `[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 | 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 |
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests** in `tests/test_setup_fields.py`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
def test_s3_reproduces_every_blastware_write():
|
||||||
|
# BE11529's 9 April images (bridges/captures/4-20-26/**/raw_bw_*.bin), in time order (the HHMMSS in
|
||||||
|
# the name): before = the previous image; the first (151921) uses the assembled 1A read in its own
|
||||||
|
# raw_s3 capture if that read is whole, else it is skipped (say so in the test). BE9441's 2 images:
|
||||||
|
# before = the assembled READS[0], then image 1. changes = field_values(after) for every field whose
|
||||||
|
# value differs. Assert encode_setup(before, 3, changes)[:2090] == after[:2090].
|
||||||
|
# The 16:26 write also moves [25] (mic on): include `_sensors_mic` as a test-only patch helper,
|
||||||
|
# not a registry field.
|
||||||
|
|
||||||
|
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": 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
|
||||||
|
def test_note_edges(): ... # "" clears; 41 bytes ok; 42 refused; "café" refused
|
||||||
|
def test_note_labels_are_never_written(): ... # changing note_2 moves only [208:250]
|
||||||
|
def test_bit_fields_keep_unknown_bits(): ... # [39] = 0x81: job_number_shown True -> 0x83, False -> 0x81
|
||||||
|
def test_s3_fixed_bytes(): ... # any S3 encode sets [26:28] = 00 00
|
||||||
|
def test_s4_encode_recomputes_the_crc(): ... # crc_ok(encode_setup(fixture, 4, {"job_number": 7}))
|
||||||
|
def test_f32_values_read_back_as_asked(): ... # written = encode(0.3); settings_state(before, written, written) == "as asked"
|
||||||
|
def test_settings_state(): ... # "as asked" / "unchanged" / "differs"; S4 with a bad CRC -> "differs"
|
||||||
|
def test_revision_is_stable_and_content_sensitive(): ...
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them.** Expected: FAIL (ModuleNotFoundError: `micromate.setup_fields`).
|
||||||
|
- [ ] **Step 3: Implement** `micromate/setup_fields.py` and `with_crc`. Decode via the registry (not via `decode_setup`, whose notes are keyed by label). Note labels come from the unit and are display only.
|
||||||
|
- [ ] **Step 4: Run them.** Expected: PASS. Then mutation-check `S3_BLASTWARE_FIXED` (remove it: the Blastware-write test fails), delete the `.pyc`, and restore.
|
||||||
|
- [ ] **Step 5: Run the full suite** and compare with the baseline. **Commit:** `feat(codec): one settings codec for both series, on the shared layout`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 3: Micromate — read the schedule file
|
||||||
|
|
||||||
|
**Measured basis:** reference *The scheduler, and a generic file transfer* and *The schedule record format*.
|
||||||
|
- `0x94 <path>` opens a file for read; `offset` = the path's length, and the payload is the path, unpadded.
|
||||||
|
- `0x48` reads the next page, repeated until an all-zero 11-byte response.
|
||||||
|
- The file is 260-byte records. `[4]` is the half-hour slot. `[6]` is the action bitmask: 2 start-with-setup, 4 stop, 8 self-check, 16 ACH. `[7]` is the name length; `[8:260]` is the name.
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `micromate/schedule.py`
|
||||||
|
- Modify: `micromate/protocol.py` (`read_file`), `micromate/client.py`
|
||||||
|
- Modify: `docs/micromate_protocol_reference.md`: one line under the scheduler section saying SFM reads it (read-only) from 2026-11-03.
|
||||||
|
- Test: `tests/test_micromate_schedule.py` (new)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces:
|
||||||
|
- `SCHEDULE_PATH = "\\system\\schedule\\schedule.dat"`.
|
||||||
|
- `MicromateProtocol.read_file(path: str) -> bytes`: the concatenated content of each `0x48` page after the page-0 descriptor, stopping at the all-zero response; at most 64 pages, else `ProtocolError`.
|
||||||
|
- `MicromateClient.read_schedule() -> bytes`.
|
||||||
|
- `MicromateClient.get_active_setup_raw() -> str`: the `0x41` name up to its NUL, **not** stripped.
|
||||||
|
- `MicromateClient.get_prefs_content() -> bytes` (`0x08`), `get_trigger_content() -> bytes` (`0x2E`) and `get_setup_content() -> bytes` (`0x1A`), each `_content(...)` of its read.
|
||||||
|
- `@dataclass(frozen=True) class ScheduleEntry`: `index: int`, `time: str` (`"HH:MM"`), `day: int`, `action_bits: int`, `actions: tuple[str, ...]`, `setup: str`.
|
||||||
|
- `parse_schedule(body: bytes) -> list[ScheduleEntry]`: 260-byte records; a record with `[4:8]` all zero and no name ends the list. `actions` names the bits 2/4/8/16 as `start_with_setup`, `stop`, `self_check` and `call_home`; any other bit becomes `unknown(0xNN)`.
|
||||||
|
- `schedule_conflicts(entries, active_setup: str) -> list[ScheduleEntry]`: start entries whose setup, compared case-insensitively after `strip()`, is not the active setup.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests.** Parse the bodies from `bridges/captures/9-24-26 - micromate2/raw_s3_20260924_191835_read_scheduler.bin` (frames 0–4), and from the two `raw_*_20260925_*` captures, with `MicromateFrameParser`.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def test_the_read_capture_parses(): # 2 records: start-with-setup 07:30 (40-char name), call_home 19:30 (no name)
|
||||||
|
def test_the_five_entry_schedule_parses(): # 07:30 start TEST1.mmb, 08:00 stop, 08:30 self_check, 09:00 start test2.mmb, 19:30 call_home
|
||||||
|
def test_conflicts_are_case_insensitive(): # active "test1.MMB" -> only the test2.mmb start conflicts
|
||||||
|
def test_no_schedule_records_is_no_conflict(): assert schedule_conflicts(parse_schedule(bytes(524)), "x.mmb") == []
|
||||||
|
def test_read_file_sends_the_path_unpadded_and_stops_at_zeros(): ... # a fake protocol: 0x94 offset 0x001D, then 0x48 until all-zero
|
||||||
|
def test_get_active_setup_raw_keeps_spaces(): ... # " LOC 4 .mmb " survives
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them.** Expected: FAIL (ModuleNotFoundError: `micromate.schedule`).
|
||||||
|
- [ ] **Step 3: Implement** the Produces block. `read_file` builds `0x94` with `build_request(0x94, len(path), bytes(10), path.encode("ascii"))`. Both SUBs are already in `READ_SUBS`.
|
||||||
|
- [ ] **Step 4: Run them.** Expected: PASS.
|
||||||
|
- [ ] **Step 5: Run the full suite** and compare with the baseline. **Commit:** `feat(micromate): read the schedule file (read-only)`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 4: Change-path pieces and the Series 4 settings change
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `sfm/device_access/errors.py`, `sfm/device_access/change.py`, `micromate/opcodes.py`, `sfm/device_access/s4.py`, `tests/device_access_fakes.py`
|
||||||
|
- Modify: `tests/test_micromate_execute.py`, `tests/test_micromate_opcodes.py`. Their over-ceiling example `0x71` becomes enableable here; use `0xA8` (delete one event) instead.
|
||||||
|
- Test: `tests/test_device_access_s4_settings.py` (new)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes:
|
||||||
|
- Task 2: `editable_fields`, `field_values`, `check_changes`, `encode_setup`, `settings_state`, `revision`.
|
||||||
|
- Task 3: `read_schedule`, `parse_schedule`, `schedule_conflicts`, `get_active_setup_raw`, and the content getters.
|
||||||
|
- `micromate.writes.plan_setup_push(prefs, trigger, setup, name)`.
|
||||||
|
- Produces:
|
||||||
|
- `class SettingsChanged(DeviceError)`, `http_status = 409`.
|
||||||
|
- `class ChangeRefused(DeviceError)`, `http_status = 409`.
|
||||||
|
- `settings_change() -> ChangeKind("change settings", "as asked", "applied")`.
|
||||||
|
- `ENABLEABLE_WRITES = frozenset({0x96, 0x97, 0x7E, 0x7F, 0xDA, 0x68, 0x73, 0x82, 0x83, 0x71, 0x72})`.
|
||||||
|
- `s4_settings(client, serial) -> UnitSettings`. It keeps every current field, plus `detail["editable"] = editable_fields(setup, 4)`. The revision comes only from a preview (dry run), never from this read.
|
||||||
|
- `s4_change_settings(client, serial, *, changes: dict, revision: Optional[str], dry_run: bool, audit, address, caller, sleep, verify_timeout_s, verify_interval_s) -> ChangeResult`.
|
||||||
|
|
||||||
|
**`s4_change_settings` behaviour**, through `run_change` (`even_if_already=False`):
|
||||||
|
|
||||||
|
- **`read_state`, first call:**
|
||||||
|
- Read the run state.
|
||||||
|
- `calling_home` and `unknown*` are returned as they are.
|
||||||
|
- `monitoring` raises `UnitStateUnknown(f"{serial} is monitoring -- stop it first (a stop makes it call in if call-home is on) -- nothing sent")`.
|
||||||
|
- Read the name (raw), prefs, trigger and setup.
|
||||||
|
- `check_changes` (a `SettingsValueError` becomes `BadRequest`).
|
||||||
|
- When live, `revision([name.encode("ascii"), prefs, trigger, setup])` must equal the request's. Otherwise raise `SettingsChanged("the unit's settings changed since the preview -- preview again; nothing sent")`.
|
||||||
|
- `image = encode_setup(setup, 4, changes)`.
|
||||||
|
- Read the schedule; a read error is kept as a blocking reason.
|
||||||
|
- Return `settings_state(setup, image, setup, series=4)`.
|
||||||
|
- **Later calls:** read the setup and return `settings_state(before, image, now, series=4)`.
|
||||||
|
- **`describe_plan`:**
|
||||||
|
- `plan_setup_push(prefs, trigger, image, name).describe()`, plus `fields` = `{f: {label, old, new}}` for the changed fields, `revision`, `warnings` and `blocked`.
|
||||||
|
- `warnings` always includes: "this reads the unit's keypad edit buffer: if someone is in its menu, their unsaved edits are sent too".
|
||||||
|
- `blocked`:
|
||||||
|
- the name is `factory.MMB` (case-insensitive): "this unit is running its factory setup; load any other setup on its keypad, then try again";
|
||||||
|
- each schedule conflict: "this unit's schedule loads <setup> at <HH:MM>, which would replace this change";
|
||||||
|
- a schedule read error: "could not read this unit's schedule (<error>) -- SFM will not change a unit whose schedule it cannot check";
|
||||||
|
- `plan_setup_push` raising `ValueError` (a block size or header THOR's offsets were never seen at, or a failed checksum): "this unit's <message> -- SFM has not seen a block like it".
|
||||||
|
- When `blocked` is non-empty, `steps` is `[]`, and a live call raises `ChangeRefused("; ".join(blocked) + " -- nothing sent")`.
|
||||||
|
- When the schedule names the active setup, `warnings` adds: "the unit's schedule loads this setup at <HH:MM>; the change survives it".
|
||||||
|
- **`send`:** `client.protocol.execute(plan)`, as `s4_change_call_home` does.
|
||||||
|
- **`snapshot`:**
|
||||||
|
- `fields`: `{f: {label, old, new, now}}`;
|
||||||
|
- `before` / `after` hex of the setup;
|
||||||
|
- `changed_offsets`;
|
||||||
|
- `prefs` and `trigger`: before hex only.
|
||||||
|
- **`is_refusal`**, **`is_ring`** and **`pre_send`**: as in `s4_change_call_home`.
|
||||||
|
|
||||||
|
**Validation order:** a live call without `revision` is refused before any I/O, in Task 6's `DeviceAccess` (not here).
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests.** Extend `FakeMicromateClient` with:
|
||||||
|
- `setup` (default: `tests/fixtures/micromate-setup/um20147_baseline.bin`'s last 2,092 bytes);
|
||||||
|
- `prefs`, `trigger` and `active_name` (default `"test2.mmb"`);
|
||||||
|
- `schedule_body` (default `bytes(524)`) and `schedule_error`;
|
||||||
|
- `execute` applies a setup-push plan's `0x71` data to `self.setup` (re-adding the CRC with `with_crc`), so a read-back sees it.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def test_s4_dry_run_previews_old_to_new_and_sends_nothing(): # fields == {"geo_trigger_ips": {"label": ..., "old": 0.5, "new": 0.3}}; revision present; fake.executed == []
|
||||||
|
def test_s4_trigger_change_sends_the_push_and_verifies(): # subs [0xDA,0x68,0x73,0x82,0x83,0x71,0x72]; outcome sent/ok; state_after "as asked"
|
||||||
|
def test_s4_stale_revision_sends_nothing(): # SettingsChanged; fake.executed == []; audit has no rows
|
||||||
|
def test_s4_already_as_asked_is_skipped(): # outcome skipped, nothing executed
|
||||||
|
def test_s4_monitoring_is_refused(dry_run in (True, False)): # "stop it first" and "nothing sent"
|
||||||
|
def test_s4_factory_setup_is_refused_live_and_shown_in_preview():
|
||||||
|
def test_s4_schedule_conflict_blocks(): # schedule starts "other.mmb" at 07:00 -> ChangeRefused naming other.mmb and 07:00
|
||||||
|
def test_s4_schedule_on_the_active_setup_warns_only():
|
||||||
|
def test_an_unreadable_schedule_refuses():
|
||||||
|
def test_no_schedule_records_is_no_conflict(): # bytes(524) -> sent
|
||||||
|
def test_s4_a_lost_ack_records_what_the_unit_holds(): # execute_error -> outcome failed, sent True, snapshot present
|
||||||
|
def test_s4_unseen_block_size_is_blocked(): # prefs 91 B -> preview blocked; live ChangeRefused; nothing executed
|
||||||
|
def test_setup_push_subs_are_now_enableable():
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them.** Expected: FAIL (ImportError: `s4_change_settings`).
|
||||||
|
- [ ] **Step 3: Implement** the Produces block and update `s4_settings`. In the two opcode tests, swap the over-ceiling example to `0xA8`.
|
||||||
|
- [ ] **Step 4: Run them**, plus `tests/test_micromate_execute.py`, `tests/test_micromate_opcodes.py`, `tests/test_micromate_writes.py` (THOR's setup-push frames still reproduce) and `tests/test_device_access_s4_call_home.py`. Expected: PASS.
|
||||||
|
- [ ] **Step 5: Run the full suite** and compare with the baseline. **Commit:** `feat(s4): change a Micromate's settings by serial, audited, schedule-checked`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 5: The Series 3 settings change
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `sfm/device_access/s3.py`, `minimateplus/client.py` (`push_config_raw` pre-check), `tests/device_access_fakes.py`
|
||||||
|
- Test: `tests/test_device_access_s3_settings.py` (new)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes:
|
||||||
|
- Task 1: `read_compliance_content`, `read_settings_blocks`, `is_compliance_content`.
|
||||||
|
- Task 2: the codec.
|
||||||
|
- Task 4: `settings_change`, `SettingsChanged`, `ChangeRefused`.
|
||||||
|
- `MiniMateClient.push_config_raw(event_index, compliance, trigger, waveform)`.
|
||||||
|
- Produces:
|
||||||
|
- `push_config_raw` raises `ImageRefused` (from `minimateplus.protocol`) when its pre-check refuses a block, before any frame.
|
||||||
|
- `Series3Adapter.settings(address, serial) -> UnitSettings`. It is built on `read_compliance_content` and the codec, with the same top-level fields as today, plus `detail["editable"]`. A non-settings answer raises `UnitStateUnknown(S3_SETTINGS_WHILE_MONITORING)`.
|
||||||
|
- `S3_SETTINGS_WHILE_MONITORING = "did not return its settings -- a MiniMate answers this way while monitoring; stop monitoring first"`.
|
||||||
|
- `Series3Adapter.change_settings(address, serial, *, changes, revision, dry_run, audit, caller, sleep, verify_timeout_s, verify_interval_s) -> ChangeResult`, through `run_change` and `self._run(address, op, retry=False)`:
|
||||||
|
- `read_serial`: `client.connect().serial`.
|
||||||
|
- **`read_state`, first call:**
|
||||||
|
- Wake, then `read_settings_blocks()`.
|
||||||
|
- A non-settings `compliance` raises `UnitStateUnknown(f"{serial} {S3_SETTINGS_WHILE_MONITORING} -- nothing sent")`.
|
||||||
|
- `check_changes`, and the live revision check over `[event_index, compliance, trigger, waveform]`.
|
||||||
|
- Compute `image = encode_setup(...)` and return `settings_state(...)`.
|
||||||
|
- **Later calls:** wake, `read_compliance_content()`, then the verdict.
|
||||||
|
- **`describe_plan`:**
|
||||||
|
- `steps` in Blastware's order: 68 (event index, as read), 73, 71 (settings block, 2,092 B), 72, 82 (trigger, as read), 83, 69 (waveform data, as read), 74, 72. Each step has `sub`, `what` and `data_len`.
|
||||||
|
- `fields`, `revision` and `warnings` as Series 4. The warning: "the two bytes after the settings block go out as 00 00 (Blastware sends its own constant; effect unmeasured)".
|
||||||
|
- **`send`:** `client.push_config_raw(event_index, image, trigger, waveform)`.
|
||||||
|
- **`is_refusal`:** `isinstance(e, ImageRefused)`.
|
||||||
|
- **`snapshot`:** as Series 4, without prefs and trigger.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests.** Extend `FakeMiniMateClient` with:
|
||||||
|
- `settings_blocks`: the default compliance is BE9441's assembled 10-26 read 2; `event_index`, `trigger` and `waveform` are the `0x68`, `0x82` and `0x69` payloads (`[16:]`) of `WRITES[13:26]` in `tests/test_minimate_write_frames.py`, each minus its two trailing bytes (a write is the read plus two);
|
||||||
|
- `push_config_raw` records its four arguments and makes the compliance the new `read_compliance_content`;
|
||||||
|
- `monitoring_settings=True` returns a device-info-shaped block.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def test_s3_settings_read_uses_the_codec(): # editable includes geo_range; record_mode "histogram"; notes by slot with unit labels
|
||||||
|
def test_s3_dry_run_previews_and_sends_nothing():
|
||||||
|
def test_s3_trigger_change_sends_the_units_own_blocks(): # push args: event_index/trigger/waveform == the read blocks; compliance == encode_setup(...)
|
||||||
|
def test_s3_change_verifies_by_read_back(): # outcome sent/ok, state_after "as asked", snapshot fields old/new/now
|
||||||
|
def test_s3_stale_revision_sends_nothing():
|
||||||
|
def test_s3_monitoring_is_refused(dry_run in (True, False)):
|
||||||
|
def test_s3_a_refused_image_is_audited_as_nothing_sent(): # push_config_raw raises ImageRefused -> row sent 0, "refused before sending"
|
||||||
|
def test_push_config_raw_precheck_raises_image_refused(): # a 2,089-byte compliance block -> ImageRefused, no frame written
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them.** Expected: FAIL (AttributeError: `change_settings`).
|
||||||
|
- [ ] **Step 3: Implement** the Produces block.
|
||||||
|
- [ ] **Step 4: Run them**, plus `tests/test_s3_call_home.py`, `tests/test_minimate_write_frames.py` and `tests/test_device_access_*`. Expected: PASS, except the tests Task 6 deletes or rewrites. If one fails here only because it pins `apply_config`, leave it for Task 6 and note that in the ledger.
|
||||||
|
- [ ] **Step 5: Run the full suite** and compare with the baseline. **Commit:** `feat(s3): change a MiniMate's settings by serial on the shared codec`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 6: Device access, the route, and retiring the legacy write
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `sfm/device_access/access.py`, `sfm/server.py`, `minimateplus/client.py`
|
||||||
|
- Delete: `poc_set_project.py`. Remove `exp_compliance_only` (and its registration) from `experiments.py`.
|
||||||
|
- **Ruling (spec: "the legacy write is retired"):** both write a live unit through the retired encoder, which #46 found wrong. Git keeps them.
|
||||||
|
- Modify tests:
|
||||||
|
- `tests/test_s3_compliance_anchor_fields.py`: remove its write-side tests (the encoder is gone).
|
||||||
|
- `tests/test_minimate_write_frames.py`: `test_apply_config_writes_the_units_own_trigger_block` moves to Task 5's `test_s3_trigger_change_sends_the_units_own_blocks`; delete it here.
|
||||||
|
- `tests/test_server_series3_guard.py`: drop `apply_config` from `WRITES` and its fake method.
|
||||||
|
- `tests/test_server_device_access.py`: `/device/config` now 410.
|
||||||
|
- Test: `tests/test_device_access_settings.py` (new), `tests/test_server_settings_change.py` (new)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: Task 4's `s4_change_settings` and Task 5's `Series3Adapter.change_settings`.
|
||||||
|
- Produces:
|
||||||
|
- `DeviceAccess.change_settings(address, serial, *, changes: dict, revision: Optional[str], dry_run: bool = False, caller: str = "api") -> ChangeResult`:
|
||||||
|
- `normalise_serial`, then `series_for_serial`;
|
||||||
|
- `changes` must be a non-empty dict, else `BadRequest`;
|
||||||
|
- a live call without `revision` raises `BadRequest("preview first: a live change needs the revision from its preview -- nothing sent")`;
|
||||||
|
- a live call with no audit log raises `NotSupported` (as `set_call_home`);
|
||||||
|
- `_dispatch(..., change=True)` with `verify_timeout_s=_SETTINGS_VERIFY_TIMEOUT_S = 2.0` and `verify_interval_s=_SETTINGS_VERIFY_INTERVAL_S = 1.0`.
|
||||||
|
- `POST /device/settings/change`:
|
||||||
|
- query: `serial` (required), `host`, `tcp_port`, `port`, `baud`, `dry_run`, `caller`;
|
||||||
|
- JSON body `{"changes": {...}, "revision": "..."}`;
|
||||||
|
- returns `_change_response(...)`;
|
||||||
|
- added to `_SERIAL_AWARE_PATHS`.
|
||||||
|
- `POST /device/config` and `POST /device/config/project` return **410** with `{"detail": "retired: change a unit's settings by serial with POST /device/settings/change (audited, previewed, read back)"}`. Remove the cache-dirty hooks that only these routes called; keep the read routes.
|
||||||
|
- Delete `MiniMateClient.apply_config`, `set_project_info` and `_encode_compliance_config`, and any import left orphaned.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests:**
|
||||||
|
|
||||||
|
```python
|
||||||
|
def test_live_change_without_revision_is_refused_before_io(): # factory never called
|
||||||
|
def test_empty_changes_is_a_bad_request():
|
||||||
|
def test_change_settings_dispatches_by_series_with_change_true():
|
||||||
|
def test_route_dry_run_returns_fields_and_revision(): # 200, body.plan.fields, body.plan.revision
|
||||||
|
def test_route_verified_change_is_200_and_mismatch_409():
|
||||||
|
def test_route_unconfirmed_carries_sent_and_audit_id():
|
||||||
|
def test_route_refusal_is_409_with_reason(): # ChangeRefused / SettingsChanged / monitoring
|
||||||
|
def test_legacy_config_routes_are_gone(): # both 410, nothing reaches a client factory
|
||||||
|
def test_settings_change_is_serial_aware(): # in _SERIAL_AWARE_PATHS; a UM serial goes to the Series-4 path
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them.** Expected: FAIL (404 / AttributeError).
|
||||||
|
- [ ] **Step 3: Implement** the Produces block, the deletions, and the test updates listed under Files.
|
||||||
|
- [ ] **Step 4: Run them**, plus `tests/test_server_*.py`. Expected: PASS. Check that `grep -rn "apply_config\|set_project_info\|_encode_compliance_config" --include=*.py .` finds only comments and history.
|
||||||
|
- [ ] **Step 5: Run the full suite** and compare with the baseline. **Commit:** `feat(sfm): POST /device/settings/change; retire the legacy config write`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 7: The page — edit, preview, send, "the unit now holds"
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `sfm/static/device_routing.js`, `sfm/static/sfm_webapp.js`, `sfm/sfm_webapp.html`
|
||||||
|
- Modify: `CLAUDE.md` (the "Where things stand" Series-4 parity line: phase 5 built, bench pending), and the spec's status line ("Built 2026-11-xx; bench pending").
|
||||||
|
- Test: `tests/test_webapp_device_routing.py` (extend `EXPORTS` and cases), `tests/test_webapp_static.py`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `UnitSettings.detail.editable` / `.revision`, and the `ChangeResult` shapes from Tasks 4–6.
|
||||||
|
- Produces (DOM-free, in `device_routing.js`):
|
||||||
|
- `DEVICE_ROUTES.settings_change = ['POST', '/device/settings/change', true]`; remove `config_write`.
|
||||||
|
- `controlsFor(unit)`: `configWrite: serialMode && (series === 3 || series === 4)`; `reasons.configWrite: 'By serial only: Preview, then Send (audited).'`
|
||||||
|
- `settingsFormFields(st) -> Array<{field, label, kind, value, unit?, min?, max?, choices?, maxlength?, readonly?}>`: from `st.detail.editable`, in that order.
|
||||||
|
- `settingsChanges(fields, edited) -> object`: only fields whose edited value differs. Numbers compare as numbers; read-only fields are ignored.
|
||||||
|
- `settingsPreviewRows(body) -> Array<[label, old, new]>`, from `body.plan.fields`.
|
||||||
|
- `settingsBlockedText(body) -> string`: `body.plan.blocked` joined; `''` if none.
|
||||||
|
- `settingsResultRows(body) -> Array<[label, old, new, now]>`, from `body.detail.snapshot.fields`.
|
||||||
|
- **Page behaviour** (`sfm_webapp.js` glue; HTML ids `cfg-edit`, `cfg-preview-btn`, `cfg-send-btn`, `cfg-preview`, `cfg-result`):
|
||||||
|
- The serial-mode Config pane heading reads **"On the unit <SERIAL> — read <HH:MM>"**.
|
||||||
|
- The form is built from `settingsFormFields`.
|
||||||
|
- **Preview** POSTs a dry run and shows old → new, warnings and blocked reasons. It keeps `revision` and enables **Send** only when nothing is blocked and something changes.
|
||||||
|
- **Send** asks `confirm()` naming the serial and the fields, then POSTs live with the kept revision and shows "the unit now holds" rows. Errors go through `changeErrorText`.
|
||||||
|
- Editing any field after a preview disables **Send** until the next preview.
|
||||||
|
- The by-host legacy form loses its write button. Its read stays.
|
||||||
|
- No inline script; listeners via `addEventListener`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing Node-run cases** in `tests/test_webapp_device_routing.py`:
|
||||||
|
- `controlsFor` gives `configWrite` true by serial for both series, and false by host;
|
||||||
|
- `settingsChanges` returns only differing fields and compares `0.30` with `0.3` as equal;
|
||||||
|
- `settingsPreviewRows` / `settingsResultRows` / `settingsBlockedText` on bodies shaped as Task 6 returns them;
|
||||||
|
- `deviceUrl('settings_change', unit)` → `/device/settings/change?serial=…`;
|
||||||
|
- `config_write` is no longer a route.
|
||||||
|
|
||||||
|
In `tests/test_webapp_static.py`, assert the page has no inline `<script>` body and loads both static files.
|
||||||
|
- [ ] **Step 2: Run them.** `…pytest tests/test_webapp_device_routing.py tests/test_webapp_static.py -q`. Expected: FAIL (`settingsChanges` is not a function).
|
||||||
|
- [ ] **Step 3: Implement** the Produces block and the page behaviour.
|
||||||
|
- [ ] **Step 4: Run them.** Expected: PASS. Then run the page under the jsdom harness pattern from phase 4 (`smoke/page_files_load.js` in the scratchpad): the page loads with no console error, and a stubbed dry-run body renders the preview rows.
|
||||||
|
- [ ] **Step 5: Update `CLAUDE.md`** and the spec status line. **Run the full suite** and compare with the baseline. **Commit:** `feat(webapp): edit a unit's settings by serial: preview, send, read back`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## After the build: final review, then the bench
|
||||||
|
|
||||||
|
The bench is not a task: it runs after the whole-branch review and its fixes, with Brian at the units, and **each send needs his explicit go**. Run SFM with `ringkit/sfm_parity.py` (port 8299; never 8200). Order:
|
||||||
|
|
||||||
|
1. **Read-only, both units:**
|
||||||
|
- `GET /device/settings` by serial; Brian matches it against each unit's screen.
|
||||||
|
- UM20147: `read_schedule` (measure what a unit with no schedule answers, and whether `0x08` shows the scheduler switch).
|
||||||
|
2. **Dry runs** of a trigger change on each unit. Read the preview with Brian.
|
||||||
|
3. **One field per unit**, with Brian's go:
|
||||||
|
- the trigger (UM20147 0.5 → 0.3; BE9441 0.04 → 0.05);
|
||||||
|
- read back; Brian checks the unit's menu;
|
||||||
|
- change it back, with another go.
|
||||||
|
4. **A notes change** on each (go).
|
||||||
|
5. **A several-field "backup unit" change** on each (go).
|
||||||
|
6. **Refusals:**
|
||||||
|
- a dry run while monitoring (expect the refusal);
|
||||||
|
- UM20147 with a schedule naming another setup, if Brian sets one up in THOR (expect the block).
|
||||||
|
7. **Alarm level (Series 3):**
|
||||||
|
- one write with Brian's go, read back and checked on BE9441's menu;
|
||||||
|
- only then flip `S3_ALARM_WRITE_MEASURED`, in its own commit naming the bench result.
|
||||||
|
|
||||||
|
Record everything in the spec's bench section and both protocol references (measured), then the devlog.
|
||||||
@@ -0,0 +1,655 @@
|
|||||||
|
# Monitor logs (.MLG) and each unit's monitoring timeline — Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** SFM reads Blastware `.MLG` files, stores them, and answers "was unit X monitoring at
|
||||||
|
time T?" and "when was it not, and why?" from each unit's monitoring timeline.
|
||||||
|
|
||||||
|
**Architecture:**
|
||||||
|
- **Codec library:** a pure reader and writer in `minimateplus/mlg_file.py`.
|
||||||
|
- **SFM:**
|
||||||
|
- two new tables, plus the original files kept in the waveform store
|
||||||
|
- one ingest function shared by the HTTP route and the bulk-import script
|
||||||
|
- the timeline as a pure function over stored rows, computed on each request
|
||||||
|
|
||||||
|
**Tech Stack:** Python 3.10, FastAPI, SQLite (`sfm/database.py`), pytest.
|
||||||
|
|
||||||
|
**Spec:** `docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md`. Read it first: the
|
||||||
|
measured format, session shapes and anti-goals are there and are not repeated here.
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- **Where to work:** worktree `~/seismo-relay-mlg`, branch `feat/mlg-import`.
|
||||||
|
- Never commit to `dev` or `main`.
|
||||||
|
- Do not touch `CHANGELOG.md` (it is written on `dev` at merge).
|
||||||
|
- **Do not edit** `minimateplus/event_file_io.py`, `decode_check.py`, `histogram_codec.py` or
|
||||||
|
`waveform_codec.py`. Another session owns them; import from them only.
|
||||||
|
- **Running tests:** `cd ~/seismo-relay-mlg && ~/seismo-relay/.venv/bin/python -m pytest …`.
|
||||||
|
- The worktree has no venv. The tests put the worktree first on `sys.path`.
|
||||||
|
- `httpx` is not installed, so `starlette.testclient` tests skip silently. Test routes by
|
||||||
|
calling the route functions directly.
|
||||||
|
- **Baseline:** 1,659 passed, 63 skipped, 0 failed. Every commit keeps 0 failed. Read the
|
||||||
|
summary line, not just the exit code.
|
||||||
|
- That baseline needs the main checkout's git-ignored fixtures in the worktree. They were
|
||||||
|
copied on 2026-11-13; without them, 13 `idf`/`save_shape` tests fail.
|
||||||
|
- If they are missing: `rsync -a --ignore-existing ~/seismo-relay/tests/fixtures/ tests/fixtures/`
|
||||||
|
- **The codec library stays pure:** `minimateplus/` never imports `sfm`, never touches a DB,
|
||||||
|
and does no I/O beyond reading a path it was given.
|
||||||
|
- **The checksum:** CRC-16/AUG-CCITT (poly `0x1021`, init `0x1D0F`, no reflection), over
|
||||||
|
`record[0:288]`, stored little-endian at `record[290:292]`. Bytes `[288:290]` are `00 00`.
|
||||||
|
- **The format:**
|
||||||
|
- prefix `10 00 01 80 00 00 "Instantel\0" 07 2c` (18 bytes), then whole 292-byte records
|
||||||
|
- each record starts with its length `22 01` (290 LE)
|
||||||
|
- id `0e a0` is the header record (always first), `0e 80` a log record
|
||||||
|
- year little-endian in every timestamp
|
||||||
|
- **Time:** unit times are naive `datetime`s on the unit's own clock, stored with
|
||||||
|
`.isoformat()` and never converted. File times are aware UTC `datetime`s.
|
||||||
|
- **Fixtures:** `tests/fixtures/` is git-ignored, so new fixtures need `git add -f`.
|
||||||
|
- **Docs:** `docs/instantel_protocol_reference.md` is LF (enforced by `tests/test_line_endings.py`).
|
||||||
|
- **Commit messages** end with:
|
||||||
|
```
|
||||||
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
||||||
|
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Review Focus
|
||||||
|
|
||||||
|
1. **An empty file whose name prefix matches two known serials** (`BE11010304.MLG` with both
|
||||||
|
`BE1101` and `BE11010` known) resolves to the longest, `BE11010`. Test: Task 4,
|
||||||
|
`test_empty_file_takes_the_longest_known_serial`.
|
||||||
|
2. **One request with a good file and a corrupted one** stores the good file and refuses the bad
|
||||||
|
one per file. Nothing of the bad one lands: no row, no file in the store. Test: Task 6,
|
||||||
|
`test_import_route_stores_good_file_and_refuses_bad_one`.
|
||||||
|
3. **The same open "monitoring started" record arriving in a second file** (a re-forward, or a
|
||||||
|
cable download) is stored once, despite its NULL stop. Test: Task 3,
|
||||||
|
`test_open_record_is_stored_once`.
|
||||||
|
4. **A serial with no `.MLG` data** gets an empty timeline and `unknown`, never a 500 or a
|
||||||
|
"not monitoring". Test: Task 6, `test_timeline_routes_for_unknown_serial`.
|
||||||
|
5. **`at` exactly on a session's start or stop, or inside the repeated hour after the
|
||||||
|
clock step back,** gives a defined answer: boundaries count as monitoring, and the repeated
|
||||||
|
hour is `ambiguous`. Tests: Task 5, `test_monitoring_at_boundaries_are_inclusive`,
|
||||||
|
`test_clock_step_back_is_not_a_negative_gap`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: The reader, and one shared CRC
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `minimateplus/crc.py`, `minimateplus/mlg_file.py`, `tests/test_mlg_file.py`
|
||||||
|
- Modify: `minimateplus/models.py` (add `MlgRecord`, `MlgFile` after `MonitorLogEntry`)
|
||||||
|
- Modify: `micromate/setup_block.py:63-69` (`_crc16_aug_ccitt` calls the shared function)
|
||||||
|
- Fixtures: `tests/fixtures/mlg-11-9-26/` (force-added)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces:
|
||||||
|
- `minimateplus.crc.crc16_aug_ccitt(data: bytes) -> int`
|
||||||
|
- `models.MlgRecord`, with fields:
|
||||||
|
- `index: int`: position in the file; 0 is the header record
|
||||||
|
- `start: datetime`, `stop: Optional[datetime]`
|
||||||
|
- `flags: int`, `trigger_source: int`, `serial: str`
|
||||||
|
- `text_raw: bytes`: exactly `record[34:288]`
|
||||||
|
- `event_time: Optional[datetime]`
|
||||||
|
- `text: str`, `trigger_level: Optional[str]`, `description: str`
|
||||||
|
- `crc_ok: bool`
|
||||||
|
- property `is_start` (`flags == 0xFFFF`)
|
||||||
|
- `models.MlgFile`:
|
||||||
|
- fields `serial: Optional[str]`, `records: list[MlgRecord]` (log records only, file order)
|
||||||
|
- properties `empty` (no records and no serial) and `crc_failures -> list[int]` (the indexes)
|
||||||
|
- `mlg_file.MlgFormatError(ValueError)`, `mlg_file.MLG_PREFIX: bytes`,
|
||||||
|
`mlg_file.RECORD_SIZE = 292`
|
||||||
|
- `mlg_file.parse_mlg(data: bytes) -> MlgFile`, `mlg_file.read_mlg(path) -> MlgFile`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Copy the fixtures and force-add them**
|
||||||
|
|
||||||
|
Copy into `tests/fixtures/mlg-11-9-26/` with `cp -p`:
|
||||||
|
- from `~/dl2-archive/mlg/mlg-slice/`: `BE128443065.MLG`, `BE128443067.MLG`,
|
||||||
|
`BE128443068.MLG`, `BE128443155.MLG`, `BE128443156.MLG`, `BE6907750.MLG`, `BE6907751.MLG`
|
||||||
|
- from `~/dl2-archive/mlg/mlg-slice2/`: `BE8081.MLG`, `BE8081321.MLG`
|
||||||
|
- from `~/seismo-relay/example-events/ach-vs-manual/`: `BE11529.MLG`, `BE115292.MLG`
|
||||||
|
- from `~/seismo-relay/example-events/10-26-26/`: `BE94412.MLG`
|
||||||
|
|
||||||
|
Then `git add -f tests/fixtures/mlg-11-9-26`. Expected: 12 files, about 14 KB.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Write the failing tests** in `tests/test_mlg_file.py`
|
||||||
|
|
||||||
|
Use `FIX = Path(__file__).parent / "fixtures" / "mlg-11-9-26"` and
|
||||||
|
`dt = datetime.datetime`.
|
||||||
|
|
||||||
|
```python
|
||||||
|
def test_crc_matches_the_micromate_rule():
|
||||||
|
from micromate.setup_block import _crc16_aug_ccitt
|
||||||
|
assert crc16_aug_ccitt(b"123456789") == _crc16_aug_ccitt(b"123456789") == 0xE5CC
|
||||||
|
|
||||||
|
def test_every_fixture_record_passes_its_checksum():
|
||||||
|
for p in FIX.glob("*.MLG"):
|
||||||
|
assert parse_mlg(p.read_bytes()).crc_failures == [], p.name
|
||||||
|
|
||||||
|
def test_closed_records(): # BE128443065
|
||||||
|
m = read_mlg(FIX / "BE128443065.MLG")
|
||||||
|
assert m.serial == "BE12844" and len(m.records) == 2
|
||||||
|
r1, r2 = m.records
|
||||||
|
assert (r1.index, r1.start, r1.stop, r1.flags, r1.trigger_source) == (
|
||||||
|
1, dt(2026, 9, 5, 18, 47, 26), dt(2026, 9, 5, 20, 0, 0), 0x0010, 0)
|
||||||
|
assert r1.description == "Timer Stop"
|
||||||
|
assert r1.trigger_level == "Geo: 0.0500 in/s Mic: 125.0 dB(L)"
|
||||||
|
assert (r2.start, r2.stop, r2.description) == (
|
||||||
|
dt(2026, 9, 6, 6, 0, 13), dt(2026, 9, 6, 18, 45, 0), "Modem Exit")
|
||||||
|
|
||||||
|
def test_monitoring_started_and_an_event(): # BE128443067
|
||||||
|
m = read_mlg(FIX / "BE128443067.MLG")
|
||||||
|
start, ev = m.records[1], m.records[2]
|
||||||
|
assert start.is_start and start.stop is None and start.description == "Monitoring started"
|
||||||
|
assert start.trigger_level == "Geo: 0.0500 in/s Mic: 125.0 dB(L)"
|
||||||
|
assert (ev.flags, ev.trigger_source, ev.description) == (0x0001, 0x0001, "Event Recorded")
|
||||||
|
assert ev.event_time == dt(2026, 9, 8, 13, 38, 22)
|
||||||
|
assert ev.text == "Geo: 0.0500 in/s Mic: 125.0 dB(L)\rTran: 0.0500 in/s"
|
||||||
|
assert ev.trigger_level == "Geo: 0.0500 in/s Mic: 125.0 dB(L)"
|
||||||
|
|
||||||
|
def test_histogram_with_a_waveform_event(): # BE8081.MLG
|
||||||
|
r = read_mlg(FIX / "BE8081.MLG").records
|
||||||
|
assert (r[1].flags, r[1].trigger_source, r[1].description) == (
|
||||||
|
0x0021, 0x0400, "Event Recorded Modem Exit")
|
||||||
|
assert r[1].trigger_level == "Histogram"
|
||||||
|
assert (r[2].trigger_source, r[2].trigger_level) == (0x0002, "Geo: 0.300 in/s")
|
||||||
|
|
||||||
|
def test_trigger_level_with_or_without_a_space_before_the_colon():
|
||||||
|
a = read_mlg(FIX / "BE11529.MLG").records[0]
|
||||||
|
b = read_mlg(FIX / "BE115292.MLG").records[0]
|
||||||
|
assert a.text == "Trigger Level: Histogram" and b.text == "Trigger Level : Histogram"
|
||||||
|
assert a.trigger_level == b.trigger_level == "Histogram"
|
||||||
|
|
||||||
|
def test_empty_file():
|
||||||
|
m = read_mlg(FIX / "BE6907751.MLG")
|
||||||
|
assert m.serial is None and m.records == [] and m.empty
|
||||||
|
|
||||||
|
def test_a_flipped_byte_fails_only_its_record():
|
||||||
|
data = bytearray((FIX / "BE128443065.MLG").read_bytes())
|
||||||
|
data[18 + 292 + 40] ^= 0xFF # inside record 1's text
|
||||||
|
m = parse_mlg(bytes(data))
|
||||||
|
assert m.crc_failures == [1]
|
||||||
|
assert m.records[0].crc_ok is False and m.records[1].crc_ok is True
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("mangle", [
|
||||||
|
lambda d: d[:-1], # not 18 + 292·n
|
||||||
|
lambda d: b"\x00" + d[1:], # wrong prefix
|
||||||
|
lambda d: d[:18] + b"\x23" + d[19:], # header length field not 290
|
||||||
|
])
|
||||||
|
def test_structure_errors_raise(mangle):
|
||||||
|
with pytest.raises(MlgFormatError):
|
||||||
|
parse_mlg(mangle((FIX / "BE128443065.MLG").read_bytes()))
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 3: Run them to verify they fail**
|
||||||
|
|
||||||
|
Run: `~/seismo-relay/.venv/bin/python -m pytest tests/test_mlg_file.py -q`
|
||||||
|
Expected: collection error, `ModuleNotFoundError: minimateplus.crc`.
|
||||||
|
|
||||||
|
- [ ] **Step 4: Implement**
|
||||||
|
|
||||||
|
**The shared CRC.** `crc16_aug_ccitt` uses the same bitwise loop as `setup_block`. Point
|
||||||
|
`setup_block._crc16_aug_ccitt` at it, keeping the name, since its tests import it.
|
||||||
|
|
||||||
|
**Timestamps.** A timestamp is `day, month, year LE (2 bytes), 0, hour, minute, second`, and
|
||||||
|
all-zero means `None`.
|
||||||
|
|
||||||
|
**`parse_mlg` raises `MlgFormatError`, naming the record, when:**
|
||||||
|
- `len < 18`, or the prefix differs
|
||||||
|
- `(len - 18) % 292 != 0`
|
||||||
|
- any record's length field is not 290
|
||||||
|
- record 0's id is not `0e a0`, or a later record's id is not `0e 80`
|
||||||
|
- a start time cannot be decoded
|
||||||
|
|
||||||
|
**A checksum failure does not raise.** It only sets `crc_ok=False`.
|
||||||
|
|
||||||
|
**The text:**
|
||||||
|
- If `text_raw[0] == 0x08`, then `event_time` is `text_raw[1:9]` and the text starts at
|
||||||
|
`text_raw[9]`.
|
||||||
|
- `text` is the bytes up to the first NUL, latin-1.
|
||||||
|
- `trigger_level` is `text`'s first line (split on `\r`), with a leading `Trigger Level :` or
|
||||||
|
`Trigger Level:` removed and stripped. An empty result is `None`.
|
||||||
|
|
||||||
|
**`description`** is `"Monitoring started"` for `is_start`. Otherwise it is
|
||||||
|
`event_file_io.monitor_log_description(flags).strip()`.
|
||||||
|
|
||||||
|
**The header record** gives `MlgFile.serial` (`record[24:34]`, NUL-stripped ASCII).
|
||||||
|
|
||||||
|
- [ ] **Step 5: Run the tests, then the whole suite**
|
||||||
|
|
||||||
|
Run: `~/seismo-relay/.venv/bin/python -m pytest tests/test_mlg_file.py tests/test_micromate_setup.py -q`
|
||||||
|
Expected: all pass.
|
||||||
|
|
||||||
|
Then the full suite. Expected: `0 failed`.
|
||||||
|
|
||||||
|
- [ ] **Step 6: Commit**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add minimateplus/crc.py minimateplus/mlg_file.py minimateplus/models.py micromate/setup_block.py tests/test_mlg_file.py
|
||||||
|
git commit -m "feat(mlg): read Blastware .MLG files, every record's checksum verified"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 2: The writer, and the old MLG code retired
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `minimateplus/mlg_file.py` (add the writer)
|
||||||
|
- Modify: `minimateplus/blastware_file.py`:
|
||||||
|
- delete `_build_mlg_header`, `_build_mlg_record`, the old `write_mlg`, the `read_mlg` stub,
|
||||||
|
`_MLG_*` and `MLG_FLAGS_*`
|
||||||
|
- the module docstring's MLG sections become one line pointing at `minimateplus/mlg_file.py`
|
||||||
|
- ⚠ **Do not re-export from `blastware_file`.** `event_file_io` imports `blastware_file`
|
||||||
|
and `mlg_file` imports `event_file_io`, so a re-export makes an import cycle. Nothing outside
|
||||||
|
`blastware_file.py` uses the old names (checked 2026-11-13).
|
||||||
|
- Test: `tests/test_mlg_file.py`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `MlgFile`, `MlgRecord` (Task 1)
|
||||||
|
- Produces:
|
||||||
|
- `mlg_file.mlg_bytes(mlg: MlgFile) -> bytes`
|
||||||
|
- `mlg_file.write_mlg(mlg: MlgFile, path) -> None`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests**
|
||||||
|
|
||||||
|
```python
|
||||||
|
@pytest.mark.parametrize("name", sorted(p.name for p in FIX.glob("*.MLG")))
|
||||||
|
def test_rebuilds_every_fixture_byte_for_byte(name):
|
||||||
|
raw = (FIX / name).read_bytes()
|
||||||
|
assert mlg_bytes(parse_mlg(raw)) == raw
|
||||||
|
|
||||||
|
def test_old_mlg_code_is_gone():
|
||||||
|
import minimateplus.blastware_file as bw
|
||||||
|
assert not hasattr(bw, "read_mlg") and not hasattr(bw, "MLG_FLAGS_TRIGGER")
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them to verify they fail** (`ImportError: mlg_bytes`)
|
||||||
|
|
||||||
|
- [ ] **Step 3: Implement `mlg_bytes`**
|
||||||
|
|
||||||
|
Write the prefix, then for a non-empty file the header record:
|
||||||
|
- length, id `0e a0`, zeros, the serial at `[24:34]`, zeros, then the CRC
|
||||||
|
|
||||||
|
Every other byte of the header record is zero on all 1,273 DL2 files (measured).
|
||||||
|
|
||||||
|
Then each log record, from its fields:
|
||||||
|
- length, id `0e 80`, both times, flags and source LE, the serial
|
||||||
|
- `text_raw`, then `00 00`, then the CRC
|
||||||
|
|
||||||
|
An empty `MlgFile` is the prefix alone. Confirm nothing else imports the deleted names:
|
||||||
|
`grep -rn "MLG_FLAGS_\|_build_mlg\|_MLG_" --include=*.py .`
|
||||||
|
|
||||||
|
- [ ] **Step 4: Run the tests and the full suite.** Expected: 12 rebuilds pass; `0 failed`.
|
||||||
|
|
||||||
|
- [ ] **Step 5: Commit**
|
||||||
|
|
||||||
|
`git commit -m "feat(mlg): write .MLG files as Blastware does; retire the old writer"`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 3: Storage
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `sfm/database.py`: the two tables appended to `_SCHEMA`, and the methods below.
|
||||||
|
- The docstring's table list gains both tables.
|
||||||
|
- No migration: `CREATE … IF NOT EXISTS` runs on every start.
|
||||||
|
- Modify: `sfm/waveform_store.py`: add `save_mlg`
|
||||||
|
- Test: `tests/test_mlg_storage.py`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `MlgRecord` (Task 1)
|
||||||
|
- Produces:
|
||||||
|
- `WaveformStore.save_mlg(serial: Optional[str], file_name: str, data: bytes) -> str`.
|
||||||
|
- Writes `<root>/<serial or "_unresolved">/mlg/<file_name>` and returns that path
|
||||||
|
relative to the root (posix).
|
||||||
|
- If that path already holds different bytes, it uses `<stem>.<sha256[:8]><suffix>`.
|
||||||
|
- If it holds the same bytes, it reuses the path.
|
||||||
|
- `SeismoDb.mlg_file_exists(file_name: str, sha256: str) -> bool`
|
||||||
|
- `SeismoDb.insert_mlg(*, serial, file_name, sha256, size, empty, call_in, file_mtime, stored_path, records) -> tuple[Optional[str], int, int]`
|
||||||
|
- One transaction; returns `(file_id, inserted, skipped)`.
|
||||||
|
- Returns `(None, 0, 0)` when `(file_name, sha256)` already exists.
|
||||||
|
- `SeismoDb.query_mlg_records(serial: str, from_dt=None, to_dt=None) -> list[dict]`:
|
||||||
|
- ascending by `start_time`, then `seq`
|
||||||
|
- keys: `id, serial, start_time, stop_time, flags, trigger_source, text, trigger_level,
|
||||||
|
event_time, file_id, seq`
|
||||||
|
- `SeismoDb.query_mlg_files(serial: str) -> list[dict]`:
|
||||||
|
- ascending by `COALESCE(file_mtime, received_at)`
|
||||||
|
- keys: `id, serial, file_name, sha256, size, record_count, empty, call_in, file_mtime,
|
||||||
|
received_at, stored_path`
|
||||||
|
- `SeismoDb.get_mlg_file(file_id: str) -> Optional[dict]`
|
||||||
|
- `SeismoDb.known_serials() -> set[str]`: distinct non-null serials from `events`,
|
||||||
|
`mlg_files` and `mlg_records`
|
||||||
|
|
||||||
|
Schema:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE TABLE IF NOT EXISTS mlg_files (
|
||||||
|
id TEXT PRIMARY KEY, serial TEXT, file_name TEXT NOT NULL, sha256 TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL, record_count INTEGER NOT NULL, empty INTEGER NOT NULL,
|
||||||
|
call_in INTEGER NOT NULL DEFAULT 1, file_mtime TEXT,
|
||||||
|
received_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
||||||
|
stored_path TEXT, UNIQUE(file_name, sha256));
|
||||||
|
CREATE TABLE IF NOT EXISTS mlg_records (
|
||||||
|
id TEXT PRIMARY KEY, serial TEXT NOT NULL, start_time TEXT NOT NULL, stop_time TEXT,
|
||||||
|
flags INTEGER NOT NULL, trigger_source INTEGER NOT NULL, text TEXT, trigger_level TEXT,
|
||||||
|
event_time TEXT, file_id TEXT NOT NULL REFERENCES mlg_files(id), seq INTEGER NOT NULL);
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS ux_mlg_records_identity
|
||||||
|
ON mlg_records(serial, start_time, COALESCE(stop_time, ''), flags, trigger_source);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_mlg_files_serial ON mlg_files(serial);
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests**
|
||||||
|
- `test_insert_and_query_round_trip`: insert BE128443067's records; query returns 3 rows in
|
||||||
|
start order, with the open record's `stop_time` None.
|
||||||
|
- `test_same_file_twice_is_a_duplicate`: the second `insert_mlg` returns `(None, 0, 0)` and
|
||||||
|
there is still one file row.
|
||||||
|
- `test_open_record_is_stored_once`: insert the same `MlgFile` under two names (as a cable
|
||||||
|
download would arrive). The second returns `inserted == 0, skipped == 3`.
|
||||||
|
- `test_records_differing_only_in_text_are_the_same_record`: `BE11529.MLG`, then
|
||||||
|
`BE115292.MLG`. The second is `(id, 0, 3)`.
|
||||||
|
- `test_known_serials`, and `test_save_mlg_keeps_both_when_names_collide`: same name,
|
||||||
|
different bytes, two paths.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them to verify they fail** (`AttributeError: insert_mlg`)
|
||||||
|
|
||||||
|
- [ ] **Step 3: Implement** the schema and the methods above. `record_count` is
|
||||||
|
`len(records)`.
|
||||||
|
|
||||||
|
- [ ] **Step 4: Run the tests and the full suite.** Expected: pass; `0 failed`.
|
||||||
|
|
||||||
|
- [ ] **Step 5: Commit**
|
||||||
|
|
||||||
|
`git commit -m "feat(mlg): store .MLG files and records, each record once"`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 4: Ingest
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `sfm/mlg_ingest.py`, `tests/test_mlg_ingest.py`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `parse_mlg`, `MlgFormatError` (Task 1); `insert_mlg`, `mlg_file_exists`,
|
||||||
|
`known_serials`, `save_mlg` (Task 3)
|
||||||
|
- Produces:
|
||||||
|
- `resolve_serial(file_name: str, header_serial: Optional[str], hint: Optional[str], known: set[str]) -> Optional[str]`
|
||||||
|
- `ingest_mlg(db, store, file_name: str, data: bytes, *, serial_hint=None, file_mtime: Optional[datetime]=None, call_in: bool=True) -> dict`
|
||||||
|
|
||||||
|
Keys: `filename, status ("ok" | "duplicate" | "error"), detail, serial, serial_unresolved,
|
||||||
|
empty, records, inserted, skipped, file_id`.
|
||||||
|
|
||||||
|
**Rules:**
|
||||||
|
- **Serial:** the header serial wins. Otherwise the hint. Otherwise the longest known serial
|
||||||
|
that the name starts with (case-insensitive), as long as only digits follow it before
|
||||||
|
`.MLG`. Otherwise `None`.
|
||||||
|
- **Order of work:**
|
||||||
|
1. parse
|
||||||
|
2. a `MlgFormatError`, or any checksum failure, is `status "error"`, with `detail` naming
|
||||||
|
the record (e.g. `"record 1 fails its checksum"`); nothing is written
|
||||||
|
3. `mlg_file_exists` gives `"duplicate"`
|
||||||
|
4. `save_mlg`
|
||||||
|
5. `insert_mlg`
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests** (a tmp `SeismoDb` and `WaveformStore`, as
|
||||||
|
`tests/test_db_snapshot_endpoints.py::_client` builds them)
|
||||||
|
- `test_ingest_ok`: BE128443067 gives `status "ok"`, serial `BE12844`, `records 3`,
|
||||||
|
`inserted 3`. The file exists in the store under `BE12844/mlg/`.
|
||||||
|
- `test_ingest_twice_is_duplicate`
|
||||||
|
- `test_corrupted_file_stores_nothing`: flip byte `18+292+40`. Expect `"error"`, `"record 1"`
|
||||||
|
in `detail`, no `mlg_files` row, and no `mlg/` directory in the store.
|
||||||
|
- `test_truncated_file_is_an_error`
|
||||||
|
- `test_empty_file_takes_known_serial`: ingest `BE6907750` then `BE6907751`. The second is
|
||||||
|
`serial "BE6907"`, `empty True`.
|
||||||
|
- `test_empty_file_without_known_serial_is_unresolved`: serial `None`,
|
||||||
|
`serial_unresolved True`, stored under `_unresolved/mlg/`.
|
||||||
|
- `test_empty_file_takes_the_longest_known_serial`:
|
||||||
|
- `resolve_serial("BE11010304.MLG", None, None, {"BE1101", "BE11010"}) == "BE11010"`
|
||||||
|
- `resolve_serial("XY123.MLG", None, None, {"BE1101"}) is None`
|
||||||
|
- `resolve_serial("BE6907751.MLG", "BE12844", "BE6907", {"BE6907"}) == "BE12844"` (the
|
||||||
|
header wins)
|
||||||
|
- `test_file_mtime_and_call_in_are_stored`
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them to verify they fail**
|
||||||
|
- [ ] **Step 3: Implement `sfm/mlg_ingest.py`**
|
||||||
|
- [ ] **Step 4: Run the tests and the full suite.** Expected: pass; `0 failed`.
|
||||||
|
- [ ] **Step 5: Commit**
|
||||||
|
|
||||||
|
`git commit -m "feat(mlg): ingest one .MLG: verify, resolve the serial, keep the original"`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 5: The timeline
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `sfm/mlg_timeline.py`, `tests/test_mlg_timeline.py`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: rows from `query_mlg_records` and `query_mlg_files` (Task 3)
|
||||||
|
- Produces:
|
||||||
|
- `build_timeline(records: list[dict], files: list[dict]) -> dict`, with keys `sessions`,
|
||||||
|
`gaps`, `clock_steps`, `call_ins`. All times are ISO strings.
|
||||||
|
- **a session:** `start, stop, end_after, end_before, ended_by, kind ("histogram" |
|
||||||
|
"monitoring"), trigger_level, running_at_last_report, events`
|
||||||
|
- **an event:** `start, stop, trigger_source, trigger_level, description`
|
||||||
|
- **a gap:** `start, stop, minutes, meaning`
|
||||||
|
- **a clock step:** `previous_stop, next_start, minutes` (negative)
|
||||||
|
- **a call-in:** `kind ("delivered" | "no_file" | "nothing_new"), unit_time, file_time,
|
||||||
|
file_name`
|
||||||
|
- `monitoring_at(timeline: dict, at: datetime) -> dict`, with keys `status ("monitoring" |
|
||||||
|
"not_monitoring" | "unknown"), ambiguous, sessions, gap, trigger_level, reason`
|
||||||
|
|
||||||
|
**Rules.** These are the spec's §4 rules, made exact.
|
||||||
|
|
||||||
|
- **Sort:** records by `(start_time, 0 if flags == 0xFFFF else 1, seq)`.
|
||||||
|
- **Record kinds:**
|
||||||
|
- **start:** `flags == 0xFFFF`
|
||||||
|
- **histogram:** `flags & 1` and `trigger_source == 0x0400`
|
||||||
|
- **event:** `flags & 1` and any other non-zero source
|
||||||
|
- **closed:** everything else
|
||||||
|
- **Building sessions, walking the sorted records:**
|
||||||
|
- **A start record opens a pending session.** Close any pending one first, with
|
||||||
|
`end_after` = its last event's stop (or its own start) and `end_before` = this start.
|
||||||
|
- **A histogram record joins the pending session** when its start is ≤ 2 s after the pending
|
||||||
|
start, giving the session `stop` and `kind "histogram"`. Otherwise it is a session of its
|
||||||
|
own.
|
||||||
|
- **An event record:**
|
||||||
|
- joins the last session if its start lies within that session's `[start, stop]`
|
||||||
|
- otherwise it joins the pending session
|
||||||
|
- an event carrying an end bit closes a pending (non-histogram) session at its stop
|
||||||
|
- with no session to join, it opens one at its own start
|
||||||
|
- **A closed record** first closes any pending session (as above, `end_before` = its start),
|
||||||
|
then is a session `[start, stop]`.
|
||||||
|
- **A session still pending at the end** has `running_at_last_report True` and
|
||||||
|
`end_after` = its last event's stop, or its start.
|
||||||
|
- **`ended_by`** is `monitor_log_description(flags & ~1).strip()` of the record that set
|
||||||
|
`stop`, or `None`. `trigger_level` is the start record's, else the stop record's.
|
||||||
|
- **Gaps:** from a session's end (`stop`, else `end_after`) to the next session's start.
|
||||||
|
- If the next start is earlier than that end, it is a clock step, not a gap.
|
||||||
|
- The meaning comes from `ended_by`:
|
||||||
|
- Modem Exit: "call-in"
|
||||||
|
- Timer Stop: "scheduled off"
|
||||||
|
- Battery Low Exit: "lost power"
|
||||||
|
- Keyboard Exit and Remote Exit: "stopped by a person"
|
||||||
|
- Memory Full Exit: "memory full"
|
||||||
|
- anything else: "unknown"
|
||||||
|
- **Call-ins**, per file in `query_mlg_files` order (`file_time` = `file_mtime`, else
|
||||||
|
`received_at`):
|
||||||
|
- **An empty file** gives `nothing_new`.
|
||||||
|
- **A `call_in` file with records** gives `delivered`, with `unit_time` = the stop of the
|
||||||
|
file's last record (by `seq`). Each Modem Exit (`flags & 0x20`, not a start) that is not
|
||||||
|
the file's last record gives `no_file`, with `unit_time` = its stop and `file_time` None.
|
||||||
|
- **Non-call-in files** give nothing.
|
||||||
|
- **`monitoring_at`:**
|
||||||
|
- **monitoring:** `start ≤ at ≤ stop`, or `≤ end_after` when the stop is unknown. Two or more
|
||||||
|
matches set `ambiguous True`.
|
||||||
|
- **unknown:** inside an unknown end window, or after `end_after` of a session running at the
|
||||||
|
last report.
|
||||||
|
- **not_monitoring:** inside a gap, with the gap.
|
||||||
|
- **unknown:** anything else, including no data.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests.** Ingest fixtures into a tmp DB with explicit
|
||||||
|
`file_mtime` values, then call `build_timeline(db.query_mlg_records(s), db.query_mlg_files(s))`.
|
||||||
|
- `test_sessions_gaps_and_an_event_session` (BE128443067 + 068):
|
||||||
|
- three sessions: `09-07 18:47:27 → 20:00:00 "Timer Stop"`; `09-08 06:00:13`, stop None,
|
||||||
|
`end_after 13:38:25`, `end_before 13:41:16`, 1 event; `13:41:16 → 18:45:00 "Modem Exit"`
|
||||||
|
- gaps: `"scheduled off"`, `minutes ≈ 600.217`; then `"unknown"`, `≈ 2.85`
|
||||||
|
- `test_monitoring_at`, on the same data:
|
||||||
|
- `09-08 10:00` is `monitoring`, trigger level `"Geo: 0.0500 in/s Mic: 125.0 dB(L)"`
|
||||||
|
- `09-08 13:40:00` is `unknown`
|
||||||
|
- `09-07 23:00` is `not_monitoring` with meaning `"scheduled off"`
|
||||||
|
- `2027-01-01` is `unknown`
|
||||||
|
- `test_monitoring_at_boundaries_are_inclusive`: `09-07 18:47:27` and `09-07 20:00:00` are
|
||||||
|
both `monitoring`.
|
||||||
|
- `test_clock_step_back_is_not_a_negative_gap` (BE128443155 + 156):
|
||||||
|
- no gap with negative minutes
|
||||||
|
- one clock step: `previous_stop 2026-11-01T18:45:00`, `next_start 2026-11-01T17:47:25`,
|
||||||
|
`minutes ≈ -57.58`
|
||||||
|
- `monitoring_at(11-01 18:00)` is `monitoring`, `ambiguous True`, 2 sessions
|
||||||
|
- `test_weekend_battery_outage_and_missed_calls` (BE8081321 alone):
|
||||||
|
- sessions start at `04-12 17:17:59` (histogram, from the start record),
|
||||||
|
`04-12 18:38:14`, `04-13 07:05:15` ("Battery Low Exit") and `04-15 12:47:05`
|
||||||
|
- the gap `04-13 10:47:15 → 04-15 12:47:05` is `"lost power"`, `minutes ≈ 2999.83`
|
||||||
|
- two `"call-in"` gaps of `≈ 5.23`
|
||||||
|
- call-ins: `no_file` at `2019-04-12T18:33:00`, `no_file` at `2019-04-13T07:00:01`,
|
||||||
|
`delivered` at `2019-04-15T17:15:00`, with `file_name "BE8081321.MLG"`
|
||||||
|
- `monitoring_at(2019-04-14 12:00)` is `not_monitoring`, `"lost power"`
|
||||||
|
- `test_histogram_session_keeps_its_waveform_event` (BE8081.MLG):
|
||||||
|
- one session `2018-02-16 15:15:31 → 15:15:49`, `kind "histogram"`,
|
||||||
|
`trigger_level "Histogram"`
|
||||||
|
- one event with `trigger_source 2` and `trigger_level "Geo: 0.300 in/s"`
|
||||||
|
- `test_event_with_an_end_bit_inside_a_histogram` (BE94412):
|
||||||
|
- the histogram session `16:06:34 → 16:07:21` keeps its stop and `"Keyboard Exit"`
|
||||||
|
- it holds the Memory Full event
|
||||||
|
- the `17:00:36` histogram is a session of its own
|
||||||
|
- `test_call_in_kinds` (BE6907750 + 751): `no_file` at `2026-08-22T18:30:00`, `delivered` at
|
||||||
|
`2026-08-23T18:30:00`, then `nothing_new`.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them to verify they fail**
|
||||||
|
- [ ] **Step 3: Implement `sfm/mlg_timeline.py`** (pure: no DB, no I/O)
|
||||||
|
- [ ] **Step 4: Run the tests and the full suite.** Expected: pass; `0 failed`.
|
||||||
|
- [ ] **Step 5: Commit**
|
||||||
|
|
||||||
|
`git commit -m "feat(mlg): each unit's monitoring timeline, and was it monitoring at T"`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 6: Routes
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `sfm/server.py`: the routes go after `db_import_idf_file`
|
||||||
|
- Create: `tests/test_mlg_routes.py`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `ingest_mlg` (Task 4); `build_timeline`, `monitoring_at` (Task 5); Task 3's queries
|
||||||
|
- Produces:
|
||||||
|
- `POST /db/import/mlg_file` → `db_import_mlg_file(files: list[UploadFile] = File(...), serial: Optional[str] = Query(None), call_in: bool = Query(True), mtimes: Optional[str] = Form(None))`.
|
||||||
|
`mtimes` is JSON `{filename: unix_seconds_utc}`. Returns `{"count", "results": [ingest
|
||||||
|
dicts]}`.
|
||||||
|
- `GET /db/units/{serial}/timeline?from_dt=&to_dt=` → `db_unit_timeline(...)`: the full
|
||||||
|
timeline, with sessions, gaps and call-ins filtered to those overlapping the window.
|
||||||
|
- `GET /db/units/{serial}/monitoring_at?at=` → `db_unit_monitoring_at(...)`
|
||||||
|
- `GET /db/mlg_records?serial=&from_dt=&to_dt=` → `db_mlg_records(...)`
|
||||||
|
- `GET /db/mlg_files/{file_id}` → `db_mlg_file(...)`: the original bytes as a `FileResponse`
|
||||||
|
with the original `file_name`; 404 if unknown.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing tests.** Set up as `_client` does (monkeypatch `srv._db` and
|
||||||
|
`srv._store`). Call the route functions directly: `asyncio.run(...)` for the import, with
|
||||||
|
`UploadFile(file=io.BytesIO(data), filename=name)`.
|
||||||
|
- `test_import_route_stores_good_file_and_refuses_bad_one`:
|
||||||
|
- two files, BE128443065 and a corrupted copy named `BE128443099.MLG`
|
||||||
|
- results: `["ok", "error"]`
|
||||||
|
- one `mlg_files` row; only the good file under the store's `mlg/`
|
||||||
|
- `test_import_route_reads_mtimes`: `mtimes='{"BE128443065.MLG": 1788734760}'` stores
|
||||||
|
`file_mtime` `2026-09-06T22:46:00+00:00`.
|
||||||
|
- `test_timeline_and_monitoring_at_routes`, with BE8081321 imported: the timeline has 4
|
||||||
|
sessions, and `monitoring_at` at `2019-04-14T12:00:00` is `not_monitoring`.
|
||||||
|
- `test_timeline_routes_for_unknown_serial`: `BE0000` gives empty `sessions`, `gaps` and
|
||||||
|
`call_ins`, and `monitoring_at` is `unknown`.
|
||||||
|
- `test_mlg_file_route_returns_original_bytes`, and a 404 for an unknown id.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Run them to verify they fail**
|
||||||
|
- [ ] **Step 3: Implement the routes.** They stay thin: parse the query, call Tasks 3–5.
|
||||||
|
- [ ] **Step 4: Run the tests and the full suite.** Expected: pass; `0 failed`.
|
||||||
|
- [ ] **Step 5: Commit**
|
||||||
|
|
||||||
|
`git commit -m "feat(mlg): /db routes: import .MLG, a unit's timeline, monitoring at T"`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 7: Bulk import and the cross-check
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `scripts/import_mlg_dir.py`, `scratch/check_mlg_vs_events.py`,
|
||||||
|
`tests/test_import_mlg_dir.py`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `ingest_mlg` (Task 4), `parse_mlg` (Task 1), `crc16_aug_ccitt` (Task 1)
|
||||||
|
- Produces:
|
||||||
|
- **`scripts/import_mlg_dir.py <dir> --db-path P --store-root S [--dry-run] [--not-call-in]`**
|
||||||
|
- `main(argv) -> int`, following `scripts/backfill_event_shape.py`
|
||||||
|
- walks `*.MLG` (case-insensitive) recursively
|
||||||
|
- **two passes:** files with records first, then the empty ones, each oldest file time
|
||||||
|
first. Every unit's serial is then known before its empty files arrive, whatever the
|
||||||
|
folder order.
|
||||||
|
- `file_mtime` from `os.stat` as UTC
|
||||||
|
- prints counts: files, ok, duplicate, error, empty, unresolved, inserted, skipped
|
||||||
|
- dry run: parse and checksums only, nothing written
|
||||||
|
- **`scratch/check_mlg_vs_events.py <mlg dir> <event dir>`**
|
||||||
|
- matches every non-start record with the Event Recorded bit to an event file by
|
||||||
|
`(serial, stop, flag word, trigger source)`
|
||||||
|
- an event file's serial number comes from its name, via
|
||||||
|
`sfm.waveform_store._serial_number_from_bw_filename`, compared with the MLG serial's
|
||||||
|
digits
|
||||||
|
- only event files inside each serial's MLG period count (its first record's start to its
|
||||||
|
last record's stop). DL2 holds years of event files from before the `.MLG`s.
|
||||||
|
- reads each event file's footer straight from its last 28 bytes: `00 1a 0e 08`, both times
|
||||||
|
with a big-endian year, flag word and source BE. It checks the footer's CRC with
|
||||||
|
`crc16_aug_ccitt` too.
|
||||||
|
- prints matched / record-only / file-only per serial, with up to 5 examples each
|
||||||
|
|
||||||
|
- [ ] **Step 1: Write the failing test.** `test_import_dir_counts`:
|
||||||
|
- copy the fixture dir to `tmp_path`
|
||||||
|
- the dry run prints `files 12`, writes no DB file and returns 0
|
||||||
|
- a real run imports 12 files with 0 errors, and a second run reports 12 duplicates
|
||||||
|
- [ ] **Step 2: Run it to verify it fails**
|
||||||
|
- [ ] **Step 3: Implement both tools**
|
||||||
|
- [ ] **Step 4: Run the tests and the full suite.** Expected: pass; `0 failed`.
|
||||||
|
- [ ] **Step 5: Run both tools on the real data, on the dev box only**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/seismo-relay/.venv/bin/python scripts/import_mlg_dir.py ~/dl2-archive/mlg --db-path /tmp/claude-1000/mlg-check.db --store-root /tmp/claude-1000/mlg-check-store
|
||||||
|
~/seismo-relay/.venv/bin/python scratch/check_mlg_vs_events.py ~/dl2-archive/mlg ~/dl2-archive/files
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected:
|
||||||
|
- 1,273 files, 0 errors, 231 empty, 0 unresolved
|
||||||
|
- BE8081: 785 matched, 0 record-only, 0 file-only
|
||||||
|
- BE6907: 6 matched, 5 record-only, 0 file-only
|
||||||
|
- BE12844: 19 matched, 37 record-only, 0 file-only
|
||||||
|
- every record-only one stops after 2026-08-25, where the DL2 copy ends
|
||||||
|
|
||||||
|
Put the numbers in the commit message.
|
||||||
|
|
||||||
|
- [ ] **Step 6: Commit**
|
||||||
|
|
||||||
|
`git commit -m "feat(mlg): bulk import, and a cross-check against the event files"`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 8: Documentation
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `docs/instantel_protocol_reference.md`:
|
||||||
|
- D.4 to D.4.3 rewritten from the spec's "What was measured", each claim graded
|
||||||
|
- the old D.4.2 table kept under a ⚠ RETRACTED banner (its CRC position, BE timestamps
|
||||||
|
and flag table)
|
||||||
|
- a row in the Changelog table at the top
|
||||||
|
- Modify: `CLAUDE.md`:
|
||||||
|
- the "SFM REST API" `/db` list gains the five routes
|
||||||
|
- one line under "Where things stand" pointing at the spec
|
||||||
|
- Modify: `docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md` §8: the footer CRC
|
||||||
|
note becomes "recorded on dev, `8544e9c`"
|
||||||
|
|
||||||
|
- [ ] **Step 1: Edit the three files**
|
||||||
|
- [ ] **Step 2: Run `tests/test_line_endings.py` and the full suite.** Expected: `0 failed`.
|
||||||
|
- [ ] **Step 3: Commit**
|
||||||
|
|
||||||
|
`git commit -m "docs: the .MLG format measured (reference D.4), and the new /db routes"`
|
||||||
@@ -0,0 +1,403 @@
|
|||||||
|
# Phase 5: changing a unit's settings by serial (design)
|
||||||
|
|
||||||
|
**Date:** 2026-11-03. **Status:** approved by Brian 2026-11-03; built 2026-11-03
|
||||||
|
(plan `docs/superpowers/plans/2026-11-03-sfm-phase5-settings.md`); **benched 2026-11-04** on both
|
||||||
|
series (results at the end). Phase 5 of
|
||||||
|
`docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md` (row 10, "change
|
||||||
|
recording settings"; build phase 5, "setup push: one field first, then several").
|
||||||
|
**Branch:** `feat/series4-sfm-parity`.
|
||||||
|
|
||||||
|
## Intent (Brian, 2026-11-03)
|
||||||
|
|
||||||
|
Change **any** of a unit's settings from SFM, and make it as easy and reliable as
|
||||||
|
possible. The goal is to fix what makes Blastware finicky. Three real cases:
|
||||||
|
|
||||||
|
- **One wrong number on a deployed unit.** UM6047 was out monitoring with its
|
||||||
|
geophone trigger at 0.03 instead of 0.300. Brian remoted into the THOR PC,
|
||||||
|
stopped it (it called in), changed the setup, made sure it was *sent*, then
|
||||||
|
restarted monitoring.
|
||||||
|
- **A typo in the notes.**
|
||||||
|
- **A backup unit.** The unit set up at the office fails in the field, so a backup
|
||||||
|
from the truck goes in with blank or stale notes and settings. There is no
|
||||||
|
computer in the field, so the office re-does the whole setup remotely, by hand,
|
||||||
|
while the person in the field stands by to press Start or power-cycle if the
|
||||||
|
link breaks.
|
||||||
|
|
||||||
|
What is wrong with THOR, as Brian and his dad experience it:
|
||||||
|
|
||||||
|
- The same screen edits a setup on disk and views a unit's setup.
|
||||||
|
- Setups get saved under random number strings.
|
||||||
|
- Editing a setup does not change the unit; you verify separately that it was sent.
|
||||||
|
|
||||||
|
Saved setups as templates would be acceptable. Not knowing whether you are
|
||||||
|
changing the unit or a file is not.
|
||||||
|
|
||||||
|
## Goals, non-goals, anti-goals
|
||||||
|
|
||||||
|
**Goals**
|
||||||
|
|
||||||
|
- Edit the unit's **live** settings, both series.
|
||||||
|
- Show exactly what will change, **old → new**, before anything is sent.
|
||||||
|
- After sending, **re-read the unit** and show what it now holds.
|
||||||
|
- Make every refusal say why, in plain words.
|
||||||
|
|
||||||
|
**Non-goals (this phase)**
|
||||||
|
|
||||||
|
- Templates, saved setups, copying from another unit.
|
||||||
|
- Restarting monitoring. **Brian presses Start**, as today; SFM never restarts on
|
||||||
|
its own.
|
||||||
|
- Setting the unit's clock. That is a later call-home receiver rule.
|
||||||
|
- **Writing the Micromate scheduler.** Next project, agreed 2026-11-03:
|
||||||
|
"record during work hours" as a plain, **configurable** setting on the unit's
|
||||||
|
page, both series, no schedule library and no setup files. On the Micromate,
|
||||||
|
it relies on the firmware's setup-less scheduler start (found in the firmware,
|
||||||
|
never sent; one bench session). On the MiniMate, its own timer setting
|
||||||
|
(undecoded). Brian's dad despises THOR's scheduler; Brian is willing to retire
|
||||||
|
it in SFM.
|
||||||
|
- Fields not yet decoded. "Any and all" grows as decoding grows.
|
||||||
|
|
||||||
|
**Anti-goals: things that would make it a failure even if it "works"**
|
||||||
|
|
||||||
|
- Any doubt about whether the unit changed.
|
||||||
|
- A screen where a file and a unit look alike, or a name SFM made up.
|
||||||
|
- Writing a byte SFM did not just read. Every byte SFM does not deliberately change
|
||||||
|
goes back exactly as read. The one exception is a byte that Blastware's (or
|
||||||
|
THOR's) own writes always set to a fixed value. Each such byte is named in the
|
||||||
|
codec with its evidence (so far: Series 3 `[26:28]` → `00 00`; my call, below).
|
||||||
|
- Sending to a monitoring unit.
|
||||||
|
- A retry. A write is sent once; what happened is read back.
|
||||||
|
|
||||||
|
## Measured basis
|
||||||
|
|
||||||
|
**1. Series 4 (Micromate): the `0x1A` setup content map.** Measured from 47
|
||||||
|
keypad snapshots on UM20147 and checksum-verified. `micromate/setup_block.py`
|
||||||
|
(`decode_setup`) reads it, with 69 tests on 15 fixtures.
|
||||||
|
|
||||||
|
| content | field |
|
||||||
|
|---|---|
|
||||||
|
| `[5]` | record mode |
|
||||||
|
| `[6:8]` | sample rate |
|
||||||
|
| `[8:10]` | histogram interval |
|
||||||
|
| `[12:16]` | pre-trigger, f32, negative |
|
||||||
|
| `[17]` | stop mode |
|
||||||
|
| `[18:22]` | record time, f32 |
|
||||||
|
| `[23]` | auto-stop |
|
||||||
|
| `[25]` | active sensors |
|
||||||
|
| `[29]` | trigger sources |
|
||||||
|
| `[30:34]` | distance |
|
||||||
|
| `[34:38]` | charge |
|
||||||
|
| `[39]` | report flags |
|
||||||
|
| `[40:42]` | job number |
|
||||||
|
| `[42:86]` | setup name |
|
||||||
|
| `[122+64n]` / `[144+64n]` | notes (label / value) |
|
||||||
|
| from `[1708]` | 48-byte channel blocks: sensor code `+4:8`, trigger `+30` (geo in/s, mic psi) |
|
||||||
|
|
||||||
|
The CRC-16/AUG-CCITT over `[0:2088]` is stored at `[2090:2092]`; THOR's write
|
||||||
|
omits it and the unit recomputes it.
|
||||||
|
|
||||||
|
- **The push sequence (from THOR's captures)** is `0xDA` (name) → `0x68`/`0x73`
|
||||||
|
(`0x08` preferences) → `0x82`/`0x83` (`0x2E` trigger) → `0x71`/`0x72` (`0x1A`
|
||||||
|
setup). `micromate.writes.plan_setup_push` reproduces THOR's frames (phase 2).
|
||||||
|
- **Not yet mapped on Series 4:** alarm level, geophone range, GPS, aux I/O, SLM
|
||||||
|
options.
|
||||||
|
|
||||||
|
**2. Series 3 (MiniMate) uses the same layout. Measured 2026-11-03.** The
|
||||||
|
compliance image as Blastware writes it is logical (unescaped), 2,092 bytes, with
|
||||||
|
`N = 2090` at `[0:2]` and the channel block "Tran" at `[1708]`.
|
||||||
|
`micromate.setup_block.decode_setup` reads it correctly:
|
||||||
|
|
||||||
|
- **BE9441's 10-26 write** (`tests/fixtures/minimate-bench-10-26-26-histogram`,
|
||||||
|
two whole sends): name, mode, 4096 sps, interval, record time 20 s, trigger
|
||||||
|
0.04 in/s, mic linear, job number and the notes all decode. Only the CRC fails
|
||||||
|
(Series 3's tail goes out stale).
|
||||||
|
- **BE11529's nine 2026-04-20 Blastware writes** (`bridges/captures/4-20-26/`,
|
||||||
|
every one with a whole image) each changed exactly the expected bytes:
|
||||||
|
|
||||||
|
| Blastware changed | bytes that moved |
|
||||||
|
|---|---|
|
||||||
|
| histogram interval (×4) | `[8:10]` |
|
||||||
|
| recording mode (×3) | `[5]` |
|
||||||
|
| geophone range | `1737` / `1785` / `1833`, the range byte at each geophone channel label `+29` |
|
||||||
|
|
||||||
|
- **The live `SUB 1A` read starts the same block.** Measured on the first data
|
||||||
|
frame of each of the four recorded reads (`_settings_replies` in
|
||||||
|
`tests/test_s3_compliance_anchor_fields.py`): unescaped, each carries `N = 2090`
|
||||||
|
12 bytes before the old "anchor", and content `[5]` reads 1 / 4 / 3 / 3. That
|
||||||
|
anchor (`be 80 00 00 00 00`) is content `[12:18]`, pre-trigger −0.25 plus stop
|
||||||
|
mode Fixed. So Series 3 can be read by content offset rather than by anchor
|
||||||
|
search, which survives an Auto-stop unit (the open question of 2026-10-17).
|
||||||
|
- **A whole `1A` read assembles to exactly the 2,090 content bytes** (measured
|
||||||
|
2026-11-03 on BE9441's 10-26 recording, 12 reads). Unescape each data frame and
|
||||||
|
take `data[11:]`. Every frame but the last then starts with one `00` byte that is
|
||||||
|
not content; drop it. This holds for Blastware's read (four 512-byte frames plus
|
||||||
|
42) and SFM's (two 1024-byte frames plus 42).
|
||||||
|
- **The round trip is exact.** Blastware re-read the block after each of its two
|
||||||
|
writes, and each re-read equals the image it had just written, all 2,090 bytes.
|
||||||
|
- **While monitoring**, the read returns `0e 'BE9441' …` (the device-info block),
|
||||||
|
as the 10-29 finding says. The unit was monitoring for 5 of the 12 reads.
|
||||||
|
- **Bytes `[26:28]`: Blastware always writes `00 00`** (all 11 writes), though the
|
||||||
|
unit reads `01 7f` after a monitoring session (BE9441 10-26, BE11529 4-20 15:19).
|
||||||
|
The unit sets them again by itself. Meaning unknown.
|
||||||
|
- **The two bytes after the block are Blastware's own.** Blastware sends a per-unit
|
||||||
|
constant: `7c ea` on all nine of BE11529's writes, `0c e9` on both of BE9441's.
|
||||||
|
It is not the block's CRC-16/AUG, and no reply in BE9441's three-hour session
|
||||||
|
contains it. SFM's `write_image` sends `00 00` there. Since a read never returns
|
||||||
|
those bytes, the read-back cannot show what the unit did with them.
|
||||||
|
- **The mode byte is shared, but its codes are not.** Series 3: `00` Single Shot,
|
||||||
|
`01` Continuous, `03` Histogram, `04` Histogram + Continuous. Series 4: `01`
|
||||||
|
Waveform, `02` Manual, `03` Histogram, `04` Combo.
|
||||||
|
- **Rules from the checker's file-side work** (seismo-relay-b6, 2026-11-03; it
|
||||||
|
measured the same content offsets on 70,042 event files and found nothing that
|
||||||
|
contradicts one shared map):
|
||||||
|
- A bitmask byte is patched **bit by bit, never rebuilt**. The trigger-sources
|
||||||
|
byte `[29]` showed an unidentified `0x80` bit on one unit.
|
||||||
|
- On Series 3, stop mode (`0` Fixed) and mic type (`2` linear) are proven for
|
||||||
|
one value each. They are not offered for writing.
|
||||||
|
- An event file's `[12:16]` is that event's captured pre-trigger, not the
|
||||||
|
setting. SFM writes only from a live read, so this matters only to anyone
|
||||||
|
tempted to build a write from a file.
|
||||||
|
- **Series-3-only fields** (measured on Series 3, not Series 4): the geophone range
|
||||||
|
byte at channel `+29`; the alarm level at channel `+38` (checker-measured on
|
||||||
|
event files; live raw `+42`).
|
||||||
|
|
||||||
|
**3. Series 3 write frames are measured (#46).** Writes use uniform escaping with
|
||||||
|
a length field. The compliance image goes in 512-byte addressed chunks. `0x68` is
|
||||||
|
written as read plus `02 00`, `0x82` plus `00 00`. The sequence is
|
||||||
|
`68→73 | 71×n→72 | 82→83 | 69→74→72`. `push_config_raw` refuses any block that
|
||||||
|
is not whole. `tests/test_minimate_write_frames.py` rebuilds Blastware's frames
|
||||||
|
byte for byte.
|
||||||
|
|
||||||
|
**4. Monitoring.**
|
||||||
|
|
||||||
|
- **Series 3:** while monitoring, the unit answers `1A` (and `0x2C`) with its
|
||||||
|
device-info block (measured 10-29 and 11-03).
|
||||||
|
- **Series 4:** it refuses call-home setup while monitoring ("Feature disabled
|
||||||
|
while monitoring", measured 11-03).
|
||||||
|
- **A stop with call-home on makes the unit call in** (measured 10-25, 10-29,
|
||||||
|
11-03).
|
||||||
|
|
||||||
|
**5. Series 4 specifics.**
|
||||||
|
|
||||||
|
- `0x1A` reads the keypad's edit buffer live: unsaved keypad edits show in the
|
||||||
|
read, and a push would commit them.
|
||||||
|
- Loading a `.MMB` replaces the active config byte for byte. The push writes
|
||||||
|
under the active setup's name (`0xDA`).
|
||||||
|
|
||||||
|
## The flow
|
||||||
|
|
||||||
|
1. **Read.** `GET /device/settings?serial=…` (it exists) returns the unit's
|
||||||
|
settings. The page shows them on the Config tab under **"On the unit BE9441 —
|
||||||
|
read 14:03"**, never anything that looks like a file.
|
||||||
|
2. **Edit and preview.** The operator changes fields, then **Preview**: a dry run.
|
||||||
|
SFM re-reads the unit's blocks on the same line, builds the new blocks, and
|
||||||
|
returns one row per field: **old → new**, plus any warnings. Nothing is sent.
|
||||||
|
3. **Send.** The same request, live, is an audited change:
|
||||||
|
- identity check, audit row, one send, never retried, read back;
|
||||||
|
- **refused with "stop monitoring first"** if the unit is monitoring, noting
|
||||||
|
that the stop makes it call in when call-home is on;
|
||||||
|
- **refused** if the unit's settings changed since the preview. The preview
|
||||||
|
carries a revision (a hash of the blocks read), and the live call must
|
||||||
|
match it.
|
||||||
|
4. **Verify.** Re-read the blocks. Every changed field must read its new value.
|
||||||
|
Every other decoded field, and every byte SFM did not deliberately change, must
|
||||||
|
read as before. The page shows **"the unit now holds"**: field, old, new, now.
|
||||||
|
Known unit-maintained bytes (the Series-4 CRC) are compared as the unit's own
|
||||||
|
checksum (`crc_ok`), not byte for byte.
|
||||||
|
5. **Start** stays the operator's button.
|
||||||
|
|
||||||
|
## Fields in the first version (Brian approved the list)
|
||||||
|
|
||||||
|
| field | Series 3 | Series 4 |
|
||||||
|
|---|---|---|
|
||||||
|
| geophone trigger level | yes (channel `+30`) | yes (channel `+30`) |
|
||||||
|
| alarm level | yes (channel `+38`; measure live) | not mapped, so not offered |
|
||||||
|
| notes: the four note slots, by the unit's own labels | yes (`Project:`, `Client:`, `User Name:`, `Seis. Loc:` on BE9441) | yes (`Location`, `Client`, `Company`, `General Notes`) |
|
||||||
|
| recording mode | yes (`[5]`; values as measured on Series 3) | yes (`[5]`; Series-4 codes) |
|
||||||
|
| sample rate | yes | yes |
|
||||||
|
| record time | yes | yes |
|
||||||
|
| histogram interval | yes | yes |
|
||||||
|
| geophone range | yes (channel `+29`) | not mapped, so not offered |
|
||||||
|
| job number (+ shown on report) | yes | yes |
|
||||||
|
|
||||||
|
A field is offered only where it is measured for that series. Values are refused
|
||||||
|
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: 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
|
||||||
|
renamed and are not identifiers). The value is at most its field width less
|
||||||
|
one byte, printable ASCII.
|
||||||
|
- Not in v1: Series 3's fifth slot, `Extended Notes` (value `\n` on BE9441).
|
||||||
|
Blastware's extended notes are unmeasured and may live elsewhere.
|
||||||
|
- Not in v1: Series 4's 16-byte field at content `[1064]` (`Loc 1` on
|
||||||
|
UM12947), undecoded.
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
- **One setup-block codec for both series.** Keep `micromate/setup_block.py` as
|
||||||
|
the field map and add `encode_setup(content, changes) -> content`: field patches
|
||||||
|
only, every other byte as given. It stays a pure codec library: no I/O, no
|
||||||
|
`sfm` imports, no import cycle with `minimateplus`. Series-specific fields (the
|
||||||
|
Series-3 range and alarm) are marked by series.
|
||||||
|
- **Series 3 read.** Assemble the `1A` read into the logical 2,090-byte block:
|
||||||
|
unescape, strip the 12-byte reply prefix and the inter-frame headers
|
||||||
|
(`read_compliance_config`). Decode it by content offset.
|
||||||
|
- **Series 3 write.** The patched logical block plus the tail becomes the
|
||||||
|
compliance image for `push_config_raw`. Event index (`0x08`), trigger (`0x2E`)
|
||||||
|
and waveform data (`0x09`) are echoed as read, in Blastware's sequence.
|
||||||
|
- On `0x09`, Blastware echoed the unit's bytes on all nine April writes
|
||||||
|
(`[200:202]` = `8c 76` read and written). Only BE9441's 10-26 writes changed
|
||||||
|
them (`17 17` read, `78 76` written, and read back so). The meaning is
|
||||||
|
unknown, so SFM echoes.
|
||||||
|
- **The raw-offset `_encode_compliance_config` is retired.**
|
||||||
|
- **The legacy write (`/device/config`, `/device/config/project`) is retired (my
|
||||||
|
call).** It retries a whole write on a TCP error, is not audited, does no
|
||||||
|
read-back, does not refuse a monitoring unit, and needs no serial: every
|
||||||
|
anti-goal at once. Its only user is the webapp's by-host Config form, and
|
||||||
|
Terra-View does not call it. Its routes answer with a pointer to the by-serial
|
||||||
|
change, and the by-host form becomes read-only.
|
||||||
|
- **Series 4 write.** `plan_setup_push(prefs, trigger, patched_setup, name)`.
|
||||||
|
- **No setup files in the operator's view (Brian, 2026-11-03).** "We treat the
|
||||||
|
Micromate setups just like Minimate setups … the unit just has its settings,
|
||||||
|
and we change it based on the job. We don't send setups to the unit." A
|
||||||
|
backup unit is usually on whatever setup its previous job left. So SFM
|
||||||
|
rewrites the setup the unit is running, in place, under its own name. It
|
||||||
|
never asks for a file or a name, and never creates one. The name may show as
|
||||||
|
a read-only detail, since the unit's screen shows it.
|
||||||
|
- **The scheduler can undo a change (Brian, 2026-11-03, with THOR's Manage
|
||||||
|
Schedules screen).** Work-hours Micromates run a THOR schedule, e.g. Start
|
||||||
|
Monitoring 07:00 with setup `Mele-PWSA-Carroll -Loc 4`, stop 18:30, repeat
|
||||||
|
daily. THOR sends the schedule with its setup, and each scheduled start loads
|
||||||
|
the setup it names. So the preview and the send read `schedule.dat` (format
|
||||||
|
decoded, reference *The schedule record format*), read-only. A start action
|
||||||
|
naming a setup other than the one being changed blocks the send: "this unit's
|
||||||
|
schedule loads <name> at 07:00, which would replace this change." When the
|
||||||
|
schedule names the active setup (the usual case after a scheduled start), the
|
||||||
|
change survives, and the preview says when the next scheduled start is.
|
||||||
|
SFM never writes the schedule in this phase.
|
||||||
|
- The name comes from the `0x41` read, unstripped.
|
||||||
|
- Refuse `factory.MMB` and any target that is not the active setup (spec). The
|
||||||
|
refusal says it plainly: "this unit is running its factory setup; load any
|
||||||
|
other setup on its keypad, then try again." Brian says the team does not use
|
||||||
|
the factory setup, so this should be rare.
|
||||||
|
- `ENABLEABLE_WRITES` gains `0xDA 0x68 0x73 0x82 0x83 0x71 0x72`.
|
||||||
|
- The keypad edit buffer: warn in the preview that a unit with someone in its
|
||||||
|
menu would have those edits committed. The check the spec names, `0x1A`
|
||||||
|
against the active `.MMB` via `0x94`/`0x48`, is a bench question first.
|
||||||
|
- **The change path.** It keeps run_change's guarantees: identity, audit, one
|
||||||
|
send, read back, `ChangeUnconfirmed` with `sent`/`audit_id`. The "state" is a
|
||||||
|
set of fields, so either `run_change` takes a verify function or a sibling core
|
||||||
|
shares its parts. The builder decides; the guarantees do not change. The audit
|
||||||
|
row keeps the per-field changes, both blocks (hex) and the verdict.
|
||||||
|
- **Routes.** `POST /device/settings/change?serial=…` (serial required) with body
|
||||||
|
`{changes: {field: value}, revision}` and `dry_run`, `caller`. The response is
|
||||||
|
per-field `old` / `new` / `now`, through `_change_response`. A dry run needs no
|
||||||
|
revision and returns one. **A live call without the revision of a preview is
|
||||||
|
refused** (my call): nothing reaches a unit unless someone saw old → new.
|
||||||
|
- **Page.** The Config tab by serial becomes the unit's edit form: Preview → Send
|
||||||
|
(confirm) → "the unit now holds". New logic goes in
|
||||||
|
`sfm/static/device_routing.js` with Node tests, and glue in
|
||||||
|
`sfm/static/sfm_webapp.js` (no inline JS).
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
- **Series 3, byte for byte.** For each of the 11 Blastware compliance writes,
|
||||||
|
apply the new encoder to the read before it (or the previous image), with the
|
||||||
|
fields Blastware changed. It must reproduce Blastware's content `[0:2090]`. The
|
||||||
|
two trailing bytes are compared separately, since they are Blastware's constant.
|
||||||
|
Ten writes change one field. BE9441's 16:26 write changes five things: mode,
|
||||||
|
sample rate 2048 → 4096, interval, the mic in the sensors byte `[25]`, and
|
||||||
|
`[26:28]`. That one is tested with all of them, through the codec, though v1's
|
||||||
|
page does not offer the sensors byte.
|
||||||
|
The frames rebuild through `push_config_raw`'s path (the #46 tests).
|
||||||
|
- **Series 3, read side.** The assembly rule above, pinned as a test on the 12
|
||||||
|
reads of BE9441's 10-26 recording. Each read-back equals the write before it.
|
||||||
|
- **Series 4.** THOR's setup-push captures still reproduce, with no field changed.
|
||||||
|
Any capture where THOR changed a field becomes a byte-for-byte test.
|
||||||
|
- **Bench, with Brian's go per send, per series:**
|
||||||
|
1. A dry run of a trigger change, then send, read back, check the unit's menu,
|
||||||
|
and change it back.
|
||||||
|
2. A notes change.
|
||||||
|
3. A several-field "backup unit" change.
|
||||||
|
4. A dry run while monitoring, expecting the refusal.
|
||||||
|
|
||||||
|
## Bench 2026-11-04 (results)
|
||||||
|
|
||||||
|
Brian at BE9441 and UM20147, each on its own modem; every send with his go.
|
||||||
|
Notes: `~/bench-logs/2026-11-04-sfm-settings/`.
|
||||||
|
|
||||||
|
- **Both series change correctly.** Each change was acknowledged, read back as
|
||||||
|
sent, and confirmed on the unit's own screen; both units ended byte for byte as
|
||||||
|
found.
|
||||||
|
- BE9441: trigger each way, a note, several fields at once, the alarm, a full
|
||||||
|
restore.
|
||||||
|
- UM20147: trigger, several fields (two notes, job number and its flag, record
|
||||||
|
time), a full restore. The unit's recomputed CRC equalled SFM's.
|
||||||
|
- **Fixed at the bench (`9992b25`):** the first live MiniMate read came back one
|
||||||
|
byte long. An escaped checksum byte leaves its `0x10` behind (about 1 frame in
|
||||||
|
85; the recordings never had it). The read now takes exactly the lengths it
|
||||||
|
asked for, and so does the waveform read (`c790e20`).
|
||||||
|
- **🔑 The keypad menu wins.** A MiniMate change sent while its setup menu is
|
||||||
|
open is acknowledged and read back, then lost when the operator presses Cancel
|
||||||
|
or Save: the menu writes its copy of the whole block back. SFM cannot see this
|
||||||
|
happen; the MiniMate preview now warns. Rule for the field-plus-office routine:
|
||||||
|
nobody in the unit's menus while the office sends.
|
||||||
|
- **The MiniMate alarm write is measured**, so it is now writable (`55c7b7b`).
|
||||||
|
- **Refused while recording, both series, nothing sent.** A recording MiniMate
|
||||||
|
sometimes leaves a preview at "no answer" rather than the refusal.
|
||||||
|
- **The Micromate scheduler switch is in no block SFM reads.** UM20147 carries a
|
||||||
|
leftover THOR schedule (Fay setup, 07:00 daily) with the switch Off; SFM blocks
|
||||||
|
it, a false alarm here. The bench used a scratch-only override.
|
||||||
|
- Next: a THOR bridge recording to find the switch (parked for work hours).
|
||||||
|
- Meanwhile, worth considering: let the operator confirm "scheduler off" in the
|
||||||
|
preview.
|
||||||
|
|
||||||
|
## Calls I made (Claude), for Brian to check
|
||||||
|
|
||||||
|
- **Series 3 `[26:28]` goes out as `00 00`, as Blastware writes it**, rather than
|
||||||
|
the `01 7f` the unit may read. Measured beats inferred: Blastware's value is on
|
||||||
|
11 accepted writes, and writing back `01 7f` has never been tried.
|
||||||
|
- **The two bytes after the Series 3 block stay `00 00`**, as `write_image` sends
|
||||||
|
them (a unit accepted that in the April 2026 test). Blastware's per-unit
|
||||||
|
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.
|
||||||
|
- **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.
|
||||||
|
- **A live send needs a preview's revision.**
|
||||||
|
- **Preview re-reads the unit** rather than trusting the page's copy, and Send
|
||||||
|
refuses if the unit changed since the preview.
|
||||||
|
- **The edit form lives on the Config tab, by serial**, replacing the legacy
|
||||||
|
read-modify-write form for units reached by serial.
|
||||||
|
|
||||||
|
## Left to the builder
|
||||||
|
|
||||||
|
- The module layout for the shared codec, within the no-cycle, pure-codec rule.
|
||||||
|
- `run_change` generalised versus a sibling core.
|
||||||
|
- The exact revision hash.
|
||||||
|
- Page layout details.
|
||||||
@@ -0,0 +1,333 @@
|
|||||||
|
# Monitor logs (.MLG) and each unit's monitoring timeline — design
|
||||||
|
|
||||||
|
**Date:** 2026-11-09 · **Branch:** `feat/mlg-import` (worktree `~/seismo-relay-mlg`) ·
|
||||||
|
**Status:** design, for review
|
||||||
|
|
||||||
|
## Why this exists
|
||||||
|
|
||||||
|
Every Series-3 unit sends a Blastware monitor log, an `.MLG` file, at every call-in, whatever mode
|
||||||
|
it is recording in. It lists each time the unit started monitoring, each event, and each time it
|
||||||
|
stopped and why. Event files cannot replace it: a unit in continuous (waveform) mode sends an event
|
||||||
|
file only when something triggers, so a quiet day leaves no file at all.
|
||||||
|
|
||||||
|
Brian named two uses (2026-11-09):
|
||||||
|
|
||||||
|
1. **Shot reports.** Every event from every unit on a site goes in the report. A unit that did not
|
||||||
|
trigger (often the farthest one) is listed as "did not trigger", with its printed `.MLG`
|
||||||
|
attached as proof it was monitoring at the time of the blast. Example: BE6907 and BE12844
|
||||||
|
monitored the same job, June to November 2026, both in continuous mode. BE6907 is much farther
|
||||||
|
away and recorded 10 events to BE12844's 55.
|
||||||
|
2. **Outage history.** It is good to know when a unit was not recording, for how long, and why. A
|
||||||
|
unit on solar and battery can die for a weekend and nobody would notice. Most units keep
|
||||||
|
recording when they cannot call in; only losing the power and then the internal battery stops
|
||||||
|
them. So this is history seen once the unit calls in again, not a live alarm.
|
||||||
|
|
||||||
|
The `.MLG` is also what the watcher's heartbeat sniffs today to show that a unit is still calling
|
||||||
|
in. SFM holding the files would later let it answer that itself.
|
||||||
|
|
||||||
|
## Goals
|
||||||
|
|
||||||
|
1. Read a Blastware `.MLG` into its records, with every record's checksum verified.
|
||||||
|
2. Accept forwarded `.MLG`s through a new import route, storing each record once.
|
||||||
|
3. Keep each unit's monitoring timeline, derived from its records: when it was recording, how each
|
||||||
|
session ended, the events inside, and the call-ins. It must answer two questions:
|
||||||
|
- was unit X monitoring at time T, and with what trigger level?
|
||||||
|
- when was it not monitoring, for how long, and why?
|
||||||
|
4. Serve the records and the timeline through `/db/*`, for Terra-View to use later.
|
||||||
|
5. Bulk-import a directory of `.MLG`s (DL2 holds about 86,000), and cross-check the records against
|
||||||
|
the event files' footers.
|
||||||
|
|
||||||
|
## Non-goals
|
||||||
|
|
||||||
|
- **The watcher forwarding `.MLG`s.** That is a change in `../series3-watcher`, Brian's call, and a
|
||||||
|
separate piece. Until it lands, `.MLG`s reach SFM only through the import route and the bulk tool.
|
||||||
|
- **Anything in Terra-View:** the timeline view, the shot report, taking "last call-in" from SFM
|
||||||
|
instead of the heartbeat. Later pieces.
|
||||||
|
- **Live "missed its call-in" alerts.** A dead unit sends nothing; this timeline shows the gap
|
||||||
|
once it is back.
|
||||||
|
- **Series 4.** Thor writes no `.MLG`.
|
||||||
|
- **Editing the event decoders** (`event_file_io.py`, `decode_check.py`, `histogram_codec.py`,
|
||||||
|
`waveform_codec.py`). Another session owns them; this project imports from them only.
|
||||||
|
|
||||||
|
## Anti-goals (would make it a failure even if it works)
|
||||||
|
|
||||||
|
- **Claiming monitoring the data does not show.** A session still open at the last call-in is
|
||||||
|
"running at the last call-in", never "running now". Where a session's end is not recorded, the
|
||||||
|
timeline says so and gives the window it lies in.
|
||||||
|
- **Dropping a damaged file or record silently.** A record that fails its checksum is reported,
|
||||||
|
never half-read into the timeline.
|
||||||
|
- **Taking the serial from the file name when the file carries it.** Names are `<serial><counter>`
|
||||||
|
with nothing between, so `BE11010304` cannot be split by reading it.
|
||||||
|
- **Mixing clocks.** Record times are the unit's own local clock. File times are the PC's. They are
|
||||||
|
stored and labelled separately.
|
||||||
|
|
||||||
|
## What was measured
|
||||||
|
|
||||||
|
Grades: **measured** means checked on the files named; **inferred** means a reading of them that
|
||||||
|
has not been tested.
|
||||||
|
|
||||||
|
**Files examined:** 1,273 `.MLG`s from DL2's `C:\Blastware 10\Event\autocall home` (BE6907 369 and
|
||||||
|
BE12844 197, from 2026; BE8081 707, 2018–19), in `~/dl2-archive/mlg/`. Also the 9 bench files in
|
||||||
|
`example-events/`. Analysis scripts used for this section are in the session scratchpad and are
|
||||||
|
not part of the build.
|
||||||
|
|
||||||
|
### The file format (measured on all 1,282 files)
|
||||||
|
|
||||||
|
- **Layout:** an 18-byte prefix `10 00 01 80 00 00 "Instantel\0" 07 2c`, then whole 292-byte
|
||||||
|
records. The size is always `18 + 292·n`.
|
||||||
|
- **Every record** is `[length uint16 LE = 0x0122 (290)][id 2 bytes] … [CRC 2 bytes]`. Id `0e a0` is
|
||||||
|
the header record (one, first, carrying the serial). Id `0e 80` is a log record.
|
||||||
|
- **Checksum:** CRC-16/AUG-CCITT (poly 0x1021, init 0x1D0F, no reflection) over the record's bytes
|
||||||
|
`[0:288]`, stored little-endian at `[290:292]`. Bytes `[288:290]` are `00 00` and not covered.
|
||||||
|
This is the rule the Micromate setup blocks use (`micromate.setup_block`). It matches **3,329 of
|
||||||
|
3,329** records, with no failures.
|
||||||
|
- The reference (D.4.2) put a CRC at the *start* of each record. That was the previous record's
|
||||||
|
tail, which is also why every file had 2 unexplained bytes at its end.
|
||||||
|
- **A log record** (offsets from its length field):
|
||||||
|
|
||||||
|
| offset | field |
|
||||||
|
|---|---|
|
||||||
|
| `[4:12]` | start: day, month, year **LE**, 0, hour, min, sec |
|
||||||
|
| `[12:20]` | stop, same format; all zeros = no stop |
|
||||||
|
| `[20:22]` | monitor-log flag word, uint16 LE: the same word as the event footer's (D.6.14) |
|
||||||
|
| `[22:24]` | trigger source, uint16 LE: `0x0001`–`0x0008` a channel, `0x0400` a histogram |
|
||||||
|
| `[24:34]` | serial, null-padded ASCII |
|
||||||
|
| `[34:…]` | text, null-padded (below) |
|
||||||
|
|
||||||
|
- **Text:**
|
||||||
|
- a "monitoring started" record: `Trigger Level : Geo: 0.0500 in/s Mic: 125.0 dB(L)`, or
|
||||||
|
`Trigger Level : Histogram`
|
||||||
|
- an event record: `08`, then the event time in 8 bytes (LE year), then
|
||||||
|
`Geo: 0.0500 in/s Mic: 125.0 dB(L)`
|
||||||
|
- a closed session: `Geo: 0.0500 in/s Mic: 125.0 dB(L)`
|
||||||
|
- **Empty files:** some files are the 18-byte prefix alone, with no records and so no serial inside.
|
||||||
|
|
||||||
|
### How Blastware writes them (measured on the 3 DL2 units)
|
||||||
|
|
||||||
|
- **One file per call-in**, named `<serial><counter>.MLG`, the counter going up by one each time.
|
||||||
|
- **No record appears in two files.** Each holds what happened since the previous call-in.
|
||||||
|
- **A file is written 1–2 minutes after the unit stops for its call-in** ("Modem Exit"). The unit's
|
||||||
|
clock and DL2's agree to within those 2 minutes.
|
||||||
|
- ⚠ Dates of files that came through a Windows zip read an hour early from March to October.
|
||||||
|
Windows converts with the offset in force at zip time, not the one at the file's date. A
|
||||||
|
robocopy copy keeps the true time.
|
||||||
|
- **BE6907 writes two empty files 2–3 minutes after nearly every real one** (230 of its 369).
|
||||||
|
BE12844 never does; BE8081 did once in 707 (`BE80811.MLG`, 2018-02-19; corrected 2026-11-13
|
||||||
|
by the final review). Inferred: the unit calls back in and has nothing new.
|
||||||
|
- **Some files hold more than one Modem Exit:** 38 files (BE8081 33, BE6907 3, BE12844 2). A
|
||||||
|
file is written just after its *last* Modem Exit. The earlier ones are calls that left no file.
|
||||||
|
Example: `BE8081321` holds Modem Exits on 2019-04-12 18:33, 04-13 07:00 and 04-15 17:15.
|
||||||
|
- Inferred: the call failed, or the PC did not take it.
|
||||||
|
- Either way, this is the "missed call-in" history Brian asked about.
|
||||||
|
- **The unit's clock steps back an hour at the first call-in after daylight saving ends.** On
|
||||||
|
2026-11-01 BE12844 ran `06:00:13 → 18:45:00` (unit still on EDT). It called in at 17:46 EST,
|
||||||
|
and its next session is `17:47:25 → 18:45:00`. BE6907 shows the same. So local times on that day
|
||||||
|
overlap. Inferred: Blastware sets the unit's clock at the call-in, and in spring the clock
|
||||||
|
steps forward the same way.
|
||||||
|
- **Blastware writes the text, not the unit.** The two bench copies of the same records
|
||||||
|
(`ach-vs-manual/BE11529.MLG`, `BE115292.MLG`) differ only in `Trigger Level: Histogram` vs
|
||||||
|
`Trigger Level : Histogram`. A record's identity must not include its text or its checksum.
|
||||||
|
- **Cable or direct downloads are cumulative.** The bench `4-3-26-multi/BE11529.MLG` repeats the
|
||||||
|
4-1 records. Only the call-in files hold "only what is new".
|
||||||
|
|
||||||
|
### How a session appears (measured on the 3 DL2 units)
|
||||||
|
|
||||||
|
- **A session with no events** is one closed record: start, stop and why it stopped. BE12844's day:
|
||||||
|
`06:00:13 → 18:45:00` "Modem Exit" (its call-in), then `18:47 → 20:00` "Timer Stop" (a
|
||||||
|
work-hours timer).
|
||||||
|
- **A session with events** is an open "monitoring started" record (flag word `ffff`, no stop),
|
||||||
|
then one record per event (`0x0001` + the channel). The unit calls in minutes after each event,
|
||||||
|
and monitoring resumes as a *new* session minutes later. Example, BE12844 on 9-8:
|
||||||
|
- `06:00:13` started, then an event `13:38:22 → 13:38:25` (Tran)
|
||||||
|
- a file written about a minute later
|
||||||
|
- next file: `13:41:16 → 18:45:00` "Modem Exit"
|
||||||
|
|
||||||
|
The first session's end is not written anywhere. It lies between the last event's stop and the
|
||||||
|
next session's start (inferred: the call-in after the event ended it).
|
||||||
|
- **A histogram session** is a "monitoring started" record at T, then a histogram record from T+1 s
|
||||||
|
to the stop, carrying the stop reason (`0x0021` = Event Recorded + Modem Exit, source `0x0400`).
|
||||||
|
- **A histogram + waveform session** also has waveform event records whose start falls inside the
|
||||||
|
histogram record's span (BE8081, 5 in 2018). Example: histogram `15:15:32 → 15:15:49`, with a
|
||||||
|
Vert event `15:15:47 → 15:15:49`. Its trigger-level text says only "Histogram". The geophone
|
||||||
|
level appears only on its event records.
|
||||||
|
|
||||||
|
### Cross-check against the event files (measured)
|
||||||
|
|
||||||
|
Each "Event Recorded" record was matched to DL2's event files by **stop time + flag word + trigger
|
||||||
|
source**:
|
||||||
|
|
||||||
|
- **BE8081:** 785 / 785 records match an event file, and all 785 of its DL2 event files in that
|
||||||
|
period have a record. 714 histogram footers start exactly at the session's "monitoring started"
|
||||||
|
record; the other 71 start where the record does.
|
||||||
|
- **BE6907 / BE12844:** 25 / 25 event files have a record. The 42 records with no file all stop
|
||||||
|
after 2026-08-25, where the DL2 copy ends.
|
||||||
|
- On 2026-08-27 both units triggered at 13:00:42 / 13:00:43, the same blast.
|
||||||
|
|
||||||
|
## Design
|
||||||
|
|
||||||
|
### 1. The reader (codec library: pure, no I/O beyond the file)
|
||||||
|
|
||||||
|
`read_mlg(path)` replaces the stub in `minimateplus/blastware_file.py` and returns a new model
|
||||||
|
(`MlgFile`, `MlgRecord` in `models.py`). It does not reuse `MonitorLogEntry`, which is the live
|
||||||
|
0x0A shape. Per record:
|
||||||
|
|
||||||
|
- start, stop (None when open), flag word, trigger source
|
||||||
|
- Blastware's words, from `event_file_io.monitor_log_description()` (imported, not copied)
|
||||||
|
- the text, plus the trigger level and the event time parsed from it
|
||||||
|
- whether the checksum passed
|
||||||
|
|
||||||
|
Per file: the serial (from the header record; None for an empty file), the records, whether the
|
||||||
|
file is whole. A file whose size is not `18 + 292·n`, or with a bad prefix, raises. A record that
|
||||||
|
fails its checksum is returned flagged; the caller decides.
|
||||||
|
|
||||||
|
### 2. `write_mlg()` (last, small)
|
||||||
|
|
||||||
|
Fix it to write what Blastware writes: little-endian times, the length-led framing and the CRC.
|
||||||
|
Test: rebuild bench and DL2 files byte for byte from what the reader returns. If the header
|
||||||
|
record's unread bytes stop that, say so and leave the writer as it is.
|
||||||
|
|
||||||
|
### 3. Storage (`sfm/database.py`)
|
||||||
|
|
||||||
|
- **The original file is kept, byte for byte,** in the waveform store beside the unit's event
|
||||||
|
files. Files are tiny (18 bytes to a few KB). It is the shot-report proof, and Blastware can
|
||||||
|
open and print it. Rows alone cannot rebuild it, because Blastware's text varies.
|
||||||
|
- **`mlg_files`:** one row per file received:
|
||||||
|
- serial, file name, size, SHA-256, record count, an empty flag
|
||||||
|
- received time, and the file's modified time (UTC, when the sender gives it)
|
||||||
|
- whether it is a call-in file (default yes; a cable download is not)
|
||||||
|
|
||||||
|
The same name with the same bytes is a re-send and is skipped. Empty files all share one
|
||||||
|
hash, so the name keeps them apart. Some names have no counter (`BE8081.MLG` was DL2's first),
|
||||||
|
so name alone is not enough. This table is the call-in history, and the only trace of an empty
|
||||||
|
file.
|
||||||
|
- **`mlg_records`:** one row per log record: serial, start, stop, flag word, trigger source, text,
|
||||||
|
and the file it first came in. Stored once:
|
||||||
|
- unique on `(serial, start, stop, flag word, trigger source)`
|
||||||
|
- ⚠ an open record's stop is NULL, and SQLite treats NULLs as distinct in a UNIQUE constraint.
|
||||||
|
The key must handle that, for example with an index on `COALESCE(stop, '')`.
|
||||||
|
- **The existing `monitor_log` table is left alone.** It holds live 0x0A rows from
|
||||||
|
`bridges/ach_server.py`, which is not in production. A future SFM call-in server would write
|
||||||
|
`.MLG`-shaped records into `mlg_records` instead.
|
||||||
|
|
||||||
|
### 4. The timeline (computed when asked, not stored)
|
||||||
|
|
||||||
|
From a unit's records in time order:
|
||||||
|
|
||||||
|
- **A closed record** with no event bit is a session `[start, stop]`, ended for its reason.
|
||||||
|
- **A histogram record** is a session from its "monitoring started" record (or its own start, when
|
||||||
|
there is none) to its stop, ended for its reason.
|
||||||
|
- **A "monitoring started" record followed by events** is a session from that start. Its end is
|
||||||
|
"between the last event's stop and the next session's start".
|
||||||
|
- **A "monitoring started" record with nothing after it yet** is "running at the last call-in".
|
||||||
|
|
||||||
|
Gaps between sessions take the reason the previous session ended with:
|
||||||
|
|
||||||
|
| previous session ended with | the gap means |
|
||||||
|
|---|---|
|
||||||
|
| Modem Exit | a call-in |
|
||||||
|
| Timer Stop | scheduled off |
|
||||||
|
| Battery Low Exit | lost power |
|
||||||
|
| Keyboard Exit / Remote Exit | stopped by a person |
|
||||||
|
| Memory Full Exit | memory full |
|
||||||
|
| none known | unknown |
|
||||||
|
|
||||||
|
- **Waveform events inside a histogram session** belong to that session. They are not sessions
|
||||||
|
of their own.
|
||||||
|
- **Trigger level is reported as logged:** the session's text, plus any geophone level its event
|
||||||
|
records carry. It is never borrowed from a neighbouring session. A histogram session with no
|
||||||
|
events says "Histogram", geophone level not logged.
|
||||||
|
- **Clock steps:** a session that starts before the previous one stopped is a clock step, not an
|
||||||
|
overlap. The timeline shows it as such, with no negative gap. Times are the unit's local clock,
|
||||||
|
as SFM's event times are; `at`, `from_dt` and `to_dt` are in that clock. If `at` falls in a
|
||||||
|
repeated hour and matches two sessions, `monitoring_at` returns both and says so. The spring
|
||||||
|
step forward will show as a gap an hour too long on that one day; that is accepted.
|
||||||
|
|
||||||
|
**Call-ins** are listed by the call each file came from:
|
||||||
|
|
||||||
|
- **Delivered:** a call-in file's last Modem Exit (unit clock), paired with the file (PC clock).
|
||||||
|
- **No file:** the earlier Modem Exits in the same file. Calls that left no file.
|
||||||
|
- **Nothing new:** an empty file, at its file time.
|
||||||
|
|
||||||
|
Cable-download files are not call-ins.
|
||||||
|
|
||||||
|
### 5. Routes (`sfm/server.py`)
|
||||||
|
|
||||||
|
- `POST /db/import/mlg_file`: one or more files, an optional serial hint, each file's modified
|
||||||
|
time when the sender has it, and `call_in` (default true).
|
||||||
|
- Mirrors `/db/import/blastware_file`: each file gets its own status, and good files are stored
|
||||||
|
even when another in the same request is not.
|
||||||
|
- Per file it returns the serial, records inserted and skipped, and whether it was empty.
|
||||||
|
- A file with any failed checksum, or that is not whole, stores nothing of itself. Its status
|
||||||
|
names the record.
|
||||||
|
- `GET /db/mlg_files/{id}`: the original file, for printing or opening in Blastware.
|
||||||
|
- `GET /db/units/{serial}/timeline?from_dt=&to_dt=`: sessions (start, end or end window, how it
|
||||||
|
ended, its events, its trigger level), gaps with their meaning, and call-ins.
|
||||||
|
- `GET /db/units/{serial}/monitoring_at?at=`: `monitoring` / `not_monitoring` / `unknown`, with the
|
||||||
|
session and records that say so, and the trigger level. This is the shot report's question.
|
||||||
|
- `GET /db/mlg_records?serial=&from_dt=&to_dt=`: the raw records.
|
||||||
|
|
||||||
|
### 6. Serial of an empty file
|
||||||
|
|
||||||
|
An empty file holds no serial. Take, in order:
|
||||||
|
|
||||||
|
1. the request's serial hint
|
||||||
|
2. the longest serial SFM already knows (units, events, `.MLG` headers) that the name starts with
|
||||||
|
3. otherwise store the file with no serial and report it as unresolved
|
||||||
|
|
||||||
|
### 7. Tools
|
||||||
|
|
||||||
|
- **`scripts/import_mlg_dir.py <dir>`:** imports a directory tree of `.MLG`s straight into the DB,
|
||||||
|
with a dry run that prints the counts. Same pattern as the backfill scripts. For DL2's ~86,000.
|
||||||
|
- Every file it reads is a call-in file (it is pointed at the ACH folder's copy).
|
||||||
|
- It records file times as found, but they matter only for empty files. A zipped copy's times
|
||||||
|
are an hour early from March to October.
|
||||||
|
- The full DL2 import should come from a robocopy copy, which keeps true times.
|
||||||
|
- **`scratch/check_mlg_vs_events.py <mlg dir> <event dir>`:** the cross-check above, in both
|
||||||
|
directions, for the whole archive.
|
||||||
|
|
||||||
|
### 8. Documentation
|
||||||
|
|
||||||
|
- Rewrite the reference's D.4 (`docs/instantel_protocol_reference.md`) with the measured framing,
|
||||||
|
checksum, fields and file behaviour, keeping the old text as a retraction. Mark D.4.3 solved.
|
||||||
|
The file is CRLF: edit it with the Edit tool.
|
||||||
|
- 🔑 **The event-file footer's checksum** (D.3.3, open since April) is the same rule:
|
||||||
|
AUG-CCITT over the footer record from its length `00 1a` through byte 24, stored big-endian,
|
||||||
|
**70,041 / 70,041** DL2 files. Recorded on `dev` by the decoder session (`8544e9c`,
|
||||||
|
2026-11-11). Inferred: every record in the event file's tail chain (D.6.13) carries one.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
TDD. Fixtures go in a dated `tests/fixtures/` directory (force-added if ignored). A small set
|
||||||
|
covering each shape:
|
||||||
|
|
||||||
|
- a closed-records day (BE12844)
|
||||||
|
- a session with an event (BE12844 #3067–#3068)
|
||||||
|
- a histogram day (BE8081)
|
||||||
|
- a Battery Low Exit (BE8081)
|
||||||
|
- an empty 18-byte file (BE6907)
|
||||||
|
- a file with calls that left no file (`BE8081321`)
|
||||||
|
- the clock step back (BE12844 #3155–#3156)
|
||||||
|
- a histogram + waveform session (`BE8081.MLG`, 2018-02-16)
|
||||||
|
- the 4 bench files, including the `ach-vs-manual` pair whose text differs
|
||||||
|
|
||||||
|
Plus one file with a byte flipped, for the checksum.
|
||||||
|
|
||||||
|
The reader, the storage (including that an open record imported twice is stored once), the
|
||||||
|
timeline cases above and the routes each get tests. The full suite has 16 known failures; read the
|
||||||
|
failure list before committing.
|
||||||
|
|
||||||
|
## Left to the builder
|
||||||
|
|
||||||
|
- Model and helper names; the exact JSON shapes of the routes.
|
||||||
|
- Whether `read_mlg` moves into its own module later.
|
||||||
|
- What the header record's other bytes hold (all zero on the files seen).
|
||||||
|
- **Not in this project:** linking a session's events to SFM's stored event ids. Terra-View may
|
||||||
|
want that later. It needs a matcher, because the events table stores neither the stop time nor
|
||||||
|
the flag word, and its times moved in 0.32.0 and 0.34.0.
|
||||||
|
|
||||||
|
## Later pieces (not this project)
|
||||||
|
|
||||||
|
- **The watcher** forwards `.MLG`s with their modified time, and the heartbeat stops sniffing them.
|
||||||
|
- **Terra-View** shows each unit's timeline, puts "monitoring during the blast" on shot reports,
|
||||||
|
and takes "last call-in" from SFM.
|
||||||
|
- **BE6907's extra call-ins:** worth a look at its modem and call-home settings.
|
||||||
-107
@@ -60,7 +60,6 @@ from minimateplus.framing import build_bw_frame, SESSION_RESET
|
|||||||
from minimateplus.client import (
|
from minimateplus.client import (
|
||||||
MiniMateClient,
|
MiniMateClient,
|
||||||
_decode_compliance_config_into,
|
_decode_compliance_config_into,
|
||||||
_encode_compliance_config,
|
|
||||||
)
|
)
|
||||||
from minimateplus.models import DeviceInfo
|
from minimateplus.models import DeviceInfo
|
||||||
|
|
||||||
@@ -462,111 +461,6 @@ def exp_fewer_polls(host: str, port: int) -> tuple[str, str, dict]:
|
|||||||
t.disconnect()
|
t.disconnect()
|
||||||
|
|
||||||
|
|
||||||
# ══════════════════════════════════════════════════════════════════════════════
|
|
||||||
# EXP6 — Compliance-only write (71×3→72), skip event index + trigger + waveform
|
|
||||||
# ══════════════════════════════════════════════════════════════════════════════
|
|
||||||
#
|
|
||||||
# Blastware's full write sequence: 68→73 | 71×3→72 | 82→83 | 69→74→72
|
|
||||||
# We want to know: can we write ONLY the compliance block (71×3→72)?
|
|
||||||
#
|
|
||||||
# Test procedure:
|
|
||||||
# 1. Read current compliance config (SUB 1A)
|
|
||||||
# 2. Patch the "notes" field to a test marker
|
|
||||||
# 3. Write ONLY 71×3→72 (skip 68, 73, 82, 83, 69, 74, final 72)
|
|
||||||
# 4. Read back (SUB 1A) and verify the change was written
|
|
||||||
# 5. Restore original value
|
|
||||||
#
|
|
||||||
# If PASS: we can push individual config fields without touching event index,
|
|
||||||
# trigger config, or waveform data — huge simplification.
|
|
||||||
# If FAIL: the device needs the full write sequence (may reject partial write).
|
|
||||||
#
|
|
||||||
# SAFETY: We restore original data in a finally block. If the restore write
|
|
||||||
# fails, the device will have the test marker in "notes" — harmless but visible.
|
|
||||||
|
|
||||||
_EXP6_MARKER = "[exp6-test]"
|
|
||||||
|
|
||||||
def exp_compliance_only(host: str, port: int) -> tuple[str, str, dict]:
|
|
||||||
"""Write compliance block alone (71×3→72), verify, and restore."""
|
|
||||||
client, info = connect_client(host, port)
|
|
||||||
original_raw: Optional[bytes] = None
|
|
||||||
try:
|
|
||||||
proto = client._proto
|
|
||||||
if proto is None:
|
|
||||||
return "FAIL", "Could not get protocol handle from client", {}
|
|
||||||
|
|
||||||
# 1. Read current compliance
|
|
||||||
print(" Reading current compliance config (SUB 1A)…")
|
|
||||||
original_raw = proto.read_compliance_config()
|
|
||||||
print(f" Got {len(original_raw)} bytes of compliance config")
|
|
||||||
|
|
||||||
# Find current notes value for display
|
|
||||||
info_obj = DeviceInfo()
|
|
||||||
_decode_compliance_config_into(original_raw, info_obj)
|
|
||||||
cc = info_obj.compliance_config
|
|
||||||
orig_notes = cc.notes if cc else "(unknown)"
|
|
||||||
print(f" Current notes field: {orig_notes!r}")
|
|
||||||
|
|
||||||
# 2. Build modified payload with test marker in notes
|
|
||||||
test_notes = _EXP6_MARKER
|
|
||||||
modified_raw = _encode_compliance_config(
|
|
||||||
original_raw,
|
|
||||||
notes=test_notes,
|
|
||||||
)
|
|
||||||
print(f" Encoded modified compliance payload ({len(modified_raw)} bytes)")
|
|
||||||
print(f" Patching notes: {orig_notes!r} → {test_notes!r}")
|
|
||||||
|
|
||||||
# 3. Write ONLY the compliance block: 71×3 → 72
|
|
||||||
print(" Writing compliance ONLY (71×3→72) — skipping 68/73/82/83/69/74…")
|
|
||||||
proto.write_compliance_config_raw(modified_raw)
|
|
||||||
print(" Write complete — device acked 71×3→72")
|
|
||||||
|
|
||||||
# 4. Read back and verify
|
|
||||||
print(" Reading back compliance config to verify…")
|
|
||||||
readback_raw = proto.read_compliance_config()
|
|
||||||
readback_info = DeviceInfo()
|
|
||||||
_decode_compliance_config_into(readback_raw, readback_info)
|
|
||||||
rb_cc = readback_info.compliance_config
|
|
||||||
readback_notes = rb_cc.notes if rb_cc else "(decode failed)"
|
|
||||||
print(f" Read-back notes: {readback_notes!r}")
|
|
||||||
|
|
||||||
write_worked = (readback_notes == test_notes)
|
|
||||||
print(f" Write verified: {write_worked}")
|
|
||||||
|
|
||||||
details = {
|
|
||||||
"original_notes": orig_notes,
|
|
||||||
"written_notes": test_notes,
|
|
||||||
"readback_notes": readback_notes,
|
|
||||||
"write_verified": write_worked,
|
|
||||||
}
|
|
||||||
|
|
||||||
if write_worked:
|
|
||||||
return "PASS", "Compliance-only write works! No event index or trigger writes needed.", details
|
|
||||||
else:
|
|
||||||
return "FAIL", f"Write was not reflected in read-back (got {readback_notes!r})", details
|
|
||||||
|
|
||||||
except ProtocolError as exc:
|
|
||||||
return "FAIL", f"Protocol error: {exc}", {}
|
|
||||||
|
|
||||||
finally:
|
|
||||||
# Restore original compliance data regardless of outcome
|
|
||||||
if original_raw is not None:
|
|
||||||
print(" Restoring original compliance config…")
|
|
||||||
try:
|
|
||||||
proto2 = client._proto
|
|
||||||
if proto2:
|
|
||||||
proto2.write_compliance_config_raw(
|
|
||||||
_encode_compliance_config(original_raw) # no-op patch = verbatim
|
|
||||||
)
|
|
||||||
print(" Restore complete")
|
|
||||||
else:
|
|
||||||
print(" WARNING: protocol handle gone — could not restore")
|
|
||||||
except Exception as exc_r:
|
|
||||||
print(f" WARNING: restore failed: {exc_r}")
|
|
||||||
client.close()
|
|
||||||
|
|
||||||
|
|
||||||
# ══════════════════════════════════════════════════════════════════════════════
|
|
||||||
# Registry + main
|
|
||||||
# ══════════════════════════════════════════════════════════════════════════════
|
# ══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
EXPERIMENTS = {
|
EXPERIMENTS = {
|
||||||
@@ -575,7 +469,6 @@ EXPERIMENTS = {
|
|||||||
"no_5a": ("EXP3", exp_no_5a, "Event record (0C) without bulk waveform (5A)"),
|
"no_5a": ("EXP3", exp_no_5a, "Event record (0C) without bulk waveform (5A)"),
|
||||||
"skip_1e": ("EXP4", exp_skip_1e, "0A/0C with cached key — skip initial 1E"),
|
"skip_1e": ("EXP4", exp_skip_1e, "0A/0C with cached key — skip initial 1E"),
|
||||||
"fewer_polls": ("EXP5", exp_fewer_polls, "1 POLL before 5A instead of Blastware's 3"),
|
"fewer_polls": ("EXP5", exp_fewer_polls, "1 POLL before 5A instead of Blastware's 3"),
|
||||||
"compliance_only": ("EXP6", exp_compliance_only, "Compliance-only write (71×3→72), no other blocks"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ from .models import (
|
|||||||
MicromateState,
|
MicromateState,
|
||||||
)
|
)
|
||||||
from .protocol import MicromateProtocol, ProtocolError
|
from .protocol import MicromateProtocol, ProtocolError
|
||||||
|
from .schedule import SCHEDULE_PATH
|
||||||
from .setup_block import decode_setup
|
from .setup_block import decode_setup
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@@ -333,6 +334,28 @@ class MicromateClient:
|
|||||||
"""`SUB 0x41` — the loaded `.MMB` file name, e.g. `TEST1.mmb`."""
|
"""`SUB 0x41` — the loaded `.MMB` file name, e.g. `TEST1.mmb`."""
|
||||||
return _cstring(_content(self._proto.read_active_setup_name()))
|
return _cstring(_content(self._proto.read_active_setup_name()))
|
||||||
|
|
||||||
|
def get_active_setup_raw(self) -> str:
|
||||||
|
"""The `0x41` name exactly as stored, up to its NUL -- NOT stripped, so a
|
||||||
|
setup push writes back the very name the unit holds."""
|
||||||
|
return _content(self._proto.read_active_setup_name()).split(b"\x00")[0].decode("ascii", "replace")
|
||||||
|
|
||||||
|
def get_prefs_content(self) -> bytes:
|
||||||
|
"""`SUB 0x08` -- the preferences block's content (a setup push sends it back)."""
|
||||||
|
return _content(self._proto.read_event_index())
|
||||||
|
|
||||||
|
def get_trigger_content(self) -> bytes:
|
||||||
|
"""`SUB 0x2E` -- the trigger block's content (a setup push sends it back)."""
|
||||||
|
return _content(self._proto.read_trigger_config())
|
||||||
|
|
||||||
|
def get_setup_content(self) -> bytes:
|
||||||
|
"""`SUB 0x1A` -- the setup block's content, undecoded (2,092 B, CRC last).
|
||||||
|
⚠ The keypad's edit buffer: unsaved menu edits come back too."""
|
||||||
|
return _content(self._proto.read_compliance_config())
|
||||||
|
|
||||||
|
def read_schedule(self) -> bytes:
|
||||||
|
"""`schedule.dat`, read-only (`micromate.schedule.parse_schedule` reads it)."""
|
||||||
|
return self._proto.read_file(SCHEDULE_PATH)
|
||||||
|
|
||||||
def get_setup(self, *, verify: bool = True) -> MicromateSetup:
|
def get_setup(self, *, verify: bool = True) -> MicromateSetup:
|
||||||
"""`SUB 0x1A` — what the unit is set to, decoded. One read.
|
"""`SUB 0x1A` — what the unit is set to, decoded. One read.
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,10 @@ READ_SUBS: Mapping[int, str] = MappingProxyType(_READ_SUBS)
|
|||||||
# (0xA8/0xAA), raw file writes (0x8D/0x8E -- they could reach the modem
|
# (0xA8/0xAA), raw file writes (0x8D/0x8E -- they could reach the modem
|
||||||
# settings) and 0xA2 never belong here without one. Phase 4 (2026-11-02) added
|
# settings) and 0xA2 never belong here without one. Phase 4 (2026-11-02) added
|
||||||
# the call-home write and its confirm (spec row 9: enable/disable only).
|
# the call-home write and its confirm (spec row 9: enable/disable only).
|
||||||
ENABLEABLE_WRITES = frozenset({0x96, 0x97, 0x7E, 0x7F})
|
# Phase 5 (2026-11-03) added the setup push -- name, preferences, trigger and setup
|
||||||
|
# blocks with their confirms -- for changing a unit's settings by serial (spec row 10).
|
||||||
|
ENABLEABLE_WRITES = frozenset({0x96, 0x97, 0x7E, 0x7F,
|
||||||
|
0xDA, 0x68, 0x73, 0x82, 0x83, 0x71, 0x72}) # + the setup push (phase 5)
|
||||||
|
|
||||||
|
|
||||||
class OpcodeRefused(RuntimeError):
|
class OpcodeRefused(RuntimeError):
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ SUB_STATE = 0x49
|
|||||||
SUB_BULK_DOWNLOAD = 0x5A
|
SUB_BULK_DOWNLOAD = 0x5A
|
||||||
SUB_POLL = 0x5B
|
SUB_POLL = 0x5B
|
||||||
SUB_ARM_EVENT = 0x93
|
SUB_ARM_EVENT = 0x93
|
||||||
|
SUB_FILE_READ_NEXT = 0x48 # file transfer: next page of the file opened by 0x94
|
||||||
|
SUB_FILE_OPEN_READ = 0x94 # file transfer: open a file by path, for reading
|
||||||
|
|
||||||
# ⚠ Reads are SINGLE-STEP. Series III probes at offset 0 to learn the length,
|
# ⚠ Reads are SINGLE-STEP. Series III probes at offset 0 to learn the length,
|
||||||
# then reads again at that length; a Micromate returns the whole block when
|
# then reads again at that length; a Micromate returns the whole block when
|
||||||
@@ -102,6 +104,10 @@ READ_ALL = 0xFFFF
|
|||||||
|
|
||||||
# The two commands that do NOT use READ_ALL, and the data length each returned
|
# The two commands that do NOT use READ_ALL, and the data length each returned
|
||||||
# on UM12947 (firmware 11.0CB).
|
# on UM12947 (firmware 11.0CB).
|
||||||
|
_FILE_OPEN_PARAMS = bytes([0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
|
||||||
|
_FILE_FIRST_PAGE_PARAMS = bytes([0, 0, 0, 0, 0, 0, 0, 1, 0, 0])
|
||||||
|
_MAX_FILE_PAGES = 64
|
||||||
|
|
||||||
_OFFSETS = {
|
_OFFSETS = {
|
||||||
SUB_POLL: 0x0030, # 59 B — the one offset THOR treats as a constant
|
SUB_POLL: 0x0030, # 59 B — the one offset THOR treats as a constant
|
||||||
SUB_SERIAL: 0x000A, # 21 B
|
SUB_SERIAL: 0x000A, # 21 B
|
||||||
@@ -376,6 +382,31 @@ class MicromateProtocol:
|
|||||||
"""
|
"""
|
||||||
return self._read(SUB_SETUP_NEXT)
|
return self._read(SUB_SETUP_NEXT)
|
||||||
|
|
||||||
|
# ── Files, by path (read-only) ────────────────────────────────────────────
|
||||||
|
|
||||||
|
def read_file(self, path: str) -> bytes:
|
||||||
|
"""A file off the unit, by full path: `0x94` + the path opens it, then
|
||||||
|
`0x48` pages follow until an all-zero reply. The first `0x48` reply is a
|
||||||
|
descriptor, not file content. Frames are THOR's exactly (UM12947 reading
|
||||||
|
`schedule.dat`, 2026-09-24): `0x94` carries `params[3] = 1` and the path,
|
||||||
|
unpadded, as data with offset = its length; the first `0x48` carries
|
||||||
|
`params[7] = 1`, the rest none. Returns the content (each page's data
|
||||||
|
after its 11-byte prefix), joined.
|
||||||
|
"""
|
||||||
|
raw = path.encode("ascii")
|
||||||
|
self._request(build_request(SUB_FILE_OPEN_READ, len(raw), _FILE_OPEN_PARAMS, raw),
|
||||||
|
0xFF - SUB_FILE_OPEN_READ)
|
||||||
|
body = bytearray()
|
||||||
|
for page in range(_MAX_FILE_PAGES):
|
||||||
|
f = self._exchange(SUB_FILE_READ_NEXT,
|
||||||
|
params=_FILE_FIRST_PAGE_PARAMS if page == 0 else bytes(10))
|
||||||
|
if page == 0:
|
||||||
|
continue # the descriptor
|
||||||
|
if not any(f.data):
|
||||||
|
return bytes(body)
|
||||||
|
body += f.data[11:]
|
||||||
|
raise ProtocolError(f"{path}: no end of file after {_MAX_FILE_PAGES} pages")
|
||||||
|
|
||||||
# ── Event chain ───────────────────────────────────────────────────────────
|
# ── Event chain ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
def arm_event(self) -> MicromateFrame:
|
def arm_event(self) -> MicromateFrame:
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
"""schedule.py -- a Micromate's schedule file, parsed. Pure; read-only by design.
|
||||||
|
|
||||||
|
THOR's scheduler lives in a file on the unit, `\\system\\schedule\\schedule.dat`,
|
||||||
|
read by path (`MicromateProtocol.read_file`). The format is decoded in
|
||||||
|
docs/micromate_protocol_reference.md, *The schedule record format* (measured on
|
||||||
|
UM12947, 2026-09-24/25): 260-byte records,
|
||||||
|
|
||||||
|
[0] record 0 only: 3 = repeat on, 2 = repeat off
|
||||||
|
[4] half-hour slot, 0-47
|
||||||
|
[5] day (3 in every record seen -- undetermined)
|
||||||
|
[6] action bitmask: 2 start monitoring with setup, 4 stop, 8 self-check,
|
||||||
|
16 auto call home
|
||||||
|
[7] setup-name length
|
||||||
|
[8:260] setup name (empty for actions that take none)
|
||||||
|
|
||||||
|
Why SFM reads it (phase 5): each scheduled start LOADS the setup it names. A
|
||||||
|
settings change to any other setup would be replaced at the next start, so SFM
|
||||||
|
refuses that change -- `schedule_conflicts`. SFM never writes the schedule.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import List, Tuple
|
||||||
|
|
||||||
|
SCHEDULE_PATH = "\\system\\schedule\\schedule.dat"
|
||||||
|
|
||||||
|
_RECORD = 260
|
||||||
|
_NAME_MAX = _RECORD - 8
|
||||||
|
_ACTIONS = ((0x02, "start_with_setup"), (0x04, "stop"), (0x08, "self_check"), (0x10, "call_home"))
|
||||||
|
_KNOWN_BITS = sum(bit for bit, _ in _ACTIONS)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class ScheduleEntry:
|
||||||
|
index: int
|
||||||
|
time: str # "HH:MM", from the half-hour slot
|
||||||
|
day: int # the raw byte; undetermined
|
||||||
|
action_bits: int
|
||||||
|
actions: Tuple[str, ...] # named bits; any other set bit as "unknown(0xNN)"
|
||||||
|
setup: str # "" when the action takes no setup
|
||||||
|
|
||||||
|
|
||||||
|
def _actions(bits: int) -> Tuple[str, ...]:
|
||||||
|
named = tuple(name for bit, name in _ACTIONS if bits & bit)
|
||||||
|
unknown = tuple(f"unknown(0x{1 << i:02x})" for i in range(8)
|
||||||
|
if bits & (1 << i) and not (1 << i) & _KNOWN_BITS)
|
||||||
|
return named + unknown
|
||||||
|
|
||||||
|
|
||||||
|
def parse_schedule(body: bytes) -> List[ScheduleEntry]:
|
||||||
|
"""The entries in a schedule file body. A record with nothing in [4:8] and
|
||||||
|
no name ends the list (the file is padded with zeros)."""
|
||||||
|
out: List[ScheduleEntry] = []
|
||||||
|
for i in range(len(body) // _RECORD):
|
||||||
|
r = body[i * _RECORD:(i + 1) * _RECORD]
|
||||||
|
n = min(r[7], _NAME_MAX)
|
||||||
|
name = r[8:8 + n].decode("ascii", "replace") if n else ""
|
||||||
|
if not any(r[4:8]) and not name:
|
||||||
|
break
|
||||||
|
slot = r[4]
|
||||||
|
out.append(ScheduleEntry(index=i, time=f"{slot // 2:02d}:{(slot % 2) * 30:02d}", day=r[5],
|
||||||
|
action_bits=r[6], actions=_actions(r[6]), setup=name))
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def _same_setup(a: str, b: str) -> bool:
|
||||||
|
return a.strip().casefold() == b.strip().casefold()
|
||||||
|
|
||||||
|
|
||||||
|
def schedule_conflicts(entries: List[ScheduleEntry], active_setup: str) -> List[ScheduleEntry]:
|
||||||
|
"""The scheduled starts that would load a setup other than `active_setup`
|
||||||
|
(compared ignoring case and surrounding spaces: THOR and the keypad disagree
|
||||||
|
on case, e.g. `factory.MMB` / `test2.mmb`)."""
|
||||||
|
return [e for e in entries
|
||||||
|
if "start_with_setup" in e.actions and e.setup and not _same_setup(e.setup, active_setup)]
|
||||||
+16
-10
@@ -15,6 +15,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
from minimateplus.crc import crc16_aug_ccitt as _crc16_aug_ccitt
|
||||||
|
|
||||||
from .models import MicromateSetup
|
from .models import MicromateSetup
|
||||||
from .protocol import ProtocolError
|
from .protocol import ProtocolError
|
||||||
|
|
||||||
@@ -23,8 +25,6 @@ class SetupChecksumError(ProtocolError):
|
|||||||
"""A config block's trailing CRC does not match its contents."""
|
"""A config block's trailing CRC does not match its contents."""
|
||||||
|
|
||||||
|
|
||||||
_CRC_POLY = 0x1021
|
|
||||||
_CRC_INIT = 0x1D0F # CRC-16/AUG-CCITT
|
|
||||||
_CONTENT_SIZE = 2092 # = content[0:2] (2090) + the 2-byte CRC
|
_CONTENT_SIZE = 2092 # = content[0:2] (2090) + the 2-byte CRC
|
||||||
|
|
||||||
# ── Head of the block ─────────────────────────────────────────────────────────
|
# ── Head of the block ─────────────────────────────────────────────────────────
|
||||||
@@ -60,14 +60,6 @@ _ACTIVE_MIC = 3 # block index (0-based)
|
|||||||
_MIC_TYPES = {2: "linear", 9: "sound_level"}
|
_MIC_TYPES = {2: "linear", 9: "sound_level"}
|
||||||
|
|
||||||
|
|
||||||
def _crc16_aug_ccitt(data: bytes) -> int:
|
|
||||||
c = _CRC_INIT
|
|
||||||
for b in data:
|
|
||||||
c ^= b << 8
|
|
||||||
for _ in range(8):
|
|
||||||
c = ((c << 1) ^ _CRC_POLY) & 0xFFFF if c & 0x8000 else (c << 1) & 0xFFFF
|
|
||||||
return c
|
|
||||||
|
|
||||||
|
|
||||||
def crc_ok(content: bytes) -> bool:
|
def crc_ok(content: bytes) -> bool:
|
||||||
"""True if a config block's trailing checksum matches its contents.
|
"""True if a config block's trailing checksum matches its contents.
|
||||||
@@ -88,6 +80,20 @@ def crc_ok(content: bytes) -> bool:
|
|||||||
return _crc16_aug_ccitt(content[: n - 2]) == int.from_bytes(content[n : n + 2], "big")
|
return _crc16_aug_ccitt(content[: n - 2]) == int.from_bytes(content[n : n + 2], "big")
|
||||||
|
|
||||||
|
|
||||||
|
def with_crc(content: bytes) -> bytes:
|
||||||
|
"""`content` with its trailing checksum recomputed: CRC-16/AUG-CCITT over
|
||||||
|
``[0:N-2]``, stored big-endian at ``[N:N+2]`` (the rule `crc_ok` checks).
|
||||||
|
THOR's write omits the checksum and the unit computes its own; this keeps a
|
||||||
|
patched block self-consistent so a plan's integrity check still means
|
||||||
|
something."""
|
||||||
|
n = int.from_bytes(content[0:2], "big")
|
||||||
|
if n < 2 or len(content) < n + 2:
|
||||||
|
raise ValueError(f"block header says {n} but the block is {len(content)} B")
|
||||||
|
out = bytearray(content)
|
||||||
|
out[n : n + 2] = _crc16_aug_ccitt(content[: n - 2]).to_bytes(2, "big")
|
||||||
|
return bytes(out)
|
||||||
|
|
||||||
|
|
||||||
def _f32(c: bytes, offset: int) -> float:
|
def _f32(c: bytes, offset: int) -> float:
|
||||||
return struct.unpack_from(">f", c, offset)[0]
|
return struct.unpack_from(">f", c, offset)[0]
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,439 @@
|
|||||||
|
"""setup_fields.py -- the settings an operator can change, for both series (phase 5).
|
||||||
|
|
||||||
|
Pure byte interpretation: no I/O, no device, no `sfm` and no `minimateplus`
|
||||||
|
imports. Every offset is into the settings block's CONTENT:
|
||||||
|
|
||||||
|
* Series 4: the `0x1A` content, 2,092 bytes (N = 2090, then its CRC).
|
||||||
|
* Series 3: the 1A read assembled by `minimateplus.protocol.
|
||||||
|
assemble_compliance_content`, 2,090 bytes (N = 2090, no CRC in the read).
|
||||||
|
|
||||||
|
**One layout.** Measured 2026-11-03: Blastware's MiniMate compliance image IS
|
||||||
|
Series IV's `0x1A` content layout (`decode_setup` reads it), and each of
|
||||||
|
BE11529's nine 2026-04-20 Blastware writes moved exactly the bytes of the field
|
||||||
|
it changed. Series 4's offsets are from the 47-snapshot keypad pass on UM20147
|
||||||
|
(2026-10-17/19). Fields measured on one series only are offered on that series
|
||||||
|
only.
|
||||||
|
|
||||||
|
**Limits are the units' own, from Instantel's manuals** (Brian, 2026-11-03: "I
|
||||||
|
want to use the actual unit limits, not just what we have done in the past"):
|
||||||
|
* 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* -- and at most the range's full
|
||||||
|
scale;
|
||||||
|
* record time: Micromate 1-90 s (*Record Time*); MiniMate up to §4.4's
|
||||||
|
*Maximum Record Times* for a 1 MB unit, channels 1-4, at the sample rate,
|
||||||
|
and 13 s in Histogram Combo (§3.8.9);
|
||||||
|
* job number 1-9999 (both manuals).
|
||||||
|
What a unit does not take, the read-back shows (`settings_state`).
|
||||||
|
|
||||||
|
tests/test_setup_fields.py holds this to Blastware's writes and the keypad
|
||||||
|
fixtures byte for byte.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
import math
|
||||||
|
import struct
|
||||||
|
from typing import Any, Dict, List, Optional, Set
|
||||||
|
|
||||||
|
from .setup_block import crc_ok, with_crc
|
||||||
|
|
||||||
|
|
||||||
|
class SettingsValueError(ValueError):
|
||||||
|
"""A requested change SFM will not make, said plainly. Nothing is sent."""
|
||||||
|
|
||||||
|
|
||||||
|
# ── Layout ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
_MODE = 5
|
||||||
|
_SAMPLE_RATE = slice(6, 8) # u16 BE
|
||||||
|
_HIST_INTERVAL = slice(8, 10) # u16 BE seconds
|
||||||
|
_RECORD_TIME = 18 # f32 BE seconds
|
||||||
|
_REPORT_FLAGS = 39 # bit 0x02 = job number on the report (measured both series)
|
||||||
|
_JOB_SHOWN = 0x02
|
||||||
|
_JOB_NUMBER = slice(40, 42) # u16 BE
|
||||||
|
|
||||||
|
_NOTE_LABEL, _NOTE_VALUE, _NOTE_STRIDE, _NOTES = 122, 144, 64, 4
|
||||||
|
_NOTE_LABEL_WIDTH, _NOTE_WIDTH = 22, 42
|
||||||
|
NOTE_MAX = _NOTE_WIDTH - 1 # a NUL always ends the value
|
||||||
|
|
||||||
|
_CHANNELS, _CHANNEL_SIZE, _GEOPHONES = 1708, 48, (0, 1, 2)
|
||||||
|
_CH_RANGE = 29 # u8: 0 Normal (10 in/s), 1 Sensitive (1.25 in/s) -- Series 3, measured
|
||||||
|
_CH_TRIGGER = 30 # f32 BE, in/s for a geophone
|
||||||
|
_CH_UNIT = slice(34, 38) # "in." / "in" (the keypad re-renders it); NOT an identifier
|
||||||
|
_CH_ALARM = 38 # f32 BE -- Series 3; write measured at the bench 2026-11-04
|
||||||
|
_FULL_SCALE = {0: 10.0, 1: 1.25}
|
||||||
|
_RANGES = {"normal": 0, "sensitive": 1}
|
||||||
|
|
||||||
|
# Blastware writes these bytes as a fixed value on every write on record (11 of 11,
|
||||||
|
# both units); the unit reads `01 7f` there after a monitoring session. Meaning
|
||||||
|
# unknown -- SFM writes what Blastware writes. Series 3 only.
|
||||||
|
S3_BLASTWARE_FIXED = {26: b"\x00\x00"}
|
||||||
|
|
||||||
|
# Measured at the bench 2026-11-04 (BE9441, Brian's go): 1.0 -> 1.5 -> 1.0 in/s,
|
||||||
|
# each acknowledged, read back, and shown in the unit's own setup menu; the write
|
||||||
|
# moved exactly channel +39 of the three geophones (the f32 at +38).
|
||||||
|
S3_ALARM_WRITE_MEASURED = True
|
||||||
|
|
||||||
|
MODES = {
|
||||||
|
3: {"single_shot": 0x00, "continuous": 0x01, "histogram": 0x03, "histogram_continuous": 0x04},
|
||||||
|
4: {"waveform": 0x01, "manual": 0x02, "histogram": 0x03, "combo": 0x04},
|
||||||
|
}
|
||||||
|
_MODE_LABELS = {
|
||||||
|
"single_shot": "Single Shot", "continuous": "Continuous", "histogram": "Histogram",
|
||||||
|
"histogram_continuous": "Histogram + Continuous", "waveform": "Waveform", "manual": "Manual",
|
||||||
|
"combo": "Combo",
|
||||||
|
}
|
||||||
|
SAMPLE_RATES = (1024, 2048, 4096)
|
||||||
|
INTERVALS = (2, 5, 15, 60, 300, 900)
|
||||||
|
TRIGGER_MIN, TRIGGER_MAX, TRIGGER_STEP = 0.005, 10.0, 0.001
|
||||||
|
RECORD_MIN_S = 1.0
|
||||||
|
S4_MAX_RECORD_S = 90.0
|
||||||
|
S3_MAX_RECORD_S = {1024: 104.0, 2048: 52.0, 4096: 26.0}
|
||||||
|
S3_COMBO_MAX_RECORD_S = 13.0
|
||||||
|
JOB_MIN, JOB_MAX = 1, 9999
|
||||||
|
|
||||||
|
_SERIES_FIELDS = {
|
||||||
|
3: ("record_mode", "sample_rate", "histogram_interval_s", "record_time_s", "geo_trigger_ips",
|
||||||
|
"geo_range", "geo_alarm_ips", "job_number", "job_number_shown",
|
||||||
|
"note_1", "note_2", "note_3", "note_4"),
|
||||||
|
4: ("record_mode", "sample_rate", "histogram_interval_s", "record_time_s", "geo_trigger_ips",
|
||||||
|
"job_number", "job_number_shown", "note_1", "note_2", "note_3", "note_4"),
|
||||||
|
}
|
||||||
|
_LEVELS = ("geo_trigger_ips", "geo_alarm_ips")
|
||||||
|
|
||||||
|
|
||||||
|
def _ch(k: int) -> int:
|
||||||
|
return _CHANNELS + _CHANNEL_SIZE * k
|
||||||
|
|
||||||
|
|
||||||
|
def _f32(c: bytes, offset: int) -> float:
|
||||||
|
return struct.unpack_from(">f", c, offset)[0]
|
||||||
|
|
||||||
|
|
||||||
|
def _shown(v: float) -> float:
|
||||||
|
"""An f32 as an operator typed it: 0.30000001192 is 0.3."""
|
||||||
|
return round(v, 6)
|
||||||
|
|
||||||
|
|
||||||
|
def _note_offsets(n: int) -> tuple:
|
||||||
|
label = _NOTE_LABEL + n * _NOTE_STRIDE
|
||||||
|
value = _NOTE_VALUE + n * _NOTE_STRIDE
|
||||||
|
return label, value
|
||||||
|
|
||||||
|
|
||||||
|
def _note_label(c: bytes, n: int) -> str:
|
||||||
|
start, _ = _note_offsets(n)
|
||||||
|
raw = c[start:start + _NOTE_LABEL_WIDTH].split(b"\x00")[0]
|
||||||
|
text = raw.decode("ascii", "replace").strip().rstrip(":").strip()
|
||||||
|
return text or f"Note {n + 1}"
|
||||||
|
|
||||||
|
|
||||||
|
def _note_value(c: bytes, n: int) -> str:
|
||||||
|
_, start = _note_offsets(n)
|
||||||
|
return c[start:start + _NOTE_WIDTH].split(b"\x00")[0].decode("ascii", "replace")
|
||||||
|
|
||||||
|
|
||||||
|
def field_bytes(series: int) -> Dict[str, Set[int]]:
|
||||||
|
"""Every byte each field may move, by content offset."""
|
||||||
|
def chans(rel: int, width: int) -> Set[int]:
|
||||||
|
return {_ch(k) + rel + i for k in _GEOPHONES for i in range(width)}
|
||||||
|
out = {
|
||||||
|
"record_mode": {_MODE},
|
||||||
|
"sample_rate": set(range(6, 8)),
|
||||||
|
"histogram_interval_s": set(range(8, 10)),
|
||||||
|
"record_time_s": set(range(_RECORD_TIME, _RECORD_TIME + 4)),
|
||||||
|
"geo_trigger_ips": chans(_CH_TRIGGER, 4),
|
||||||
|
"geo_range": chans(_CH_RANGE, 1),
|
||||||
|
"geo_alarm_ips": chans(_CH_ALARM, 4),
|
||||||
|
"job_number": set(range(40, 42)),
|
||||||
|
"job_number_shown": {_REPORT_FLAGS},
|
||||||
|
}
|
||||||
|
for n in range(_NOTES):
|
||||||
|
_, v = _note_offsets(n)
|
||||||
|
out[f"note_{n + 1}"] = set(range(v, v + _NOTE_WIDTH))
|
||||||
|
return {f: out[f] for f in _SERIES_FIELDS[series]}
|
||||||
|
|
||||||
|
|
||||||
|
# ── Reading ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def _mode_name(c: bytes, series: int) -> str:
|
||||||
|
code = c[_MODE]
|
||||||
|
for name, value in MODES[series].items():
|
||||||
|
if value == code:
|
||||||
|
return name
|
||||||
|
return f"unknown(0x{code:02x})"
|
||||||
|
|
||||||
|
|
||||||
|
def _range_code(c: bytes) -> int:
|
||||||
|
return c[_ch(0) + _CH_RANGE]
|
||||||
|
|
||||||
|
|
||||||
|
def _full_scale(c: bytes, series: int, range_name: Optional[str] = None) -> Optional[float]:
|
||||||
|
if series == 4:
|
||||||
|
return _FULL_SCALE[0] # Series 4's range byte is not mapped; 10 in/s is the hardware's
|
||||||
|
code = _RANGES[range_name] if range_name is not None else _range_code(c)
|
||||||
|
return _FULL_SCALE.get(code)
|
||||||
|
|
||||||
|
|
||||||
|
def _s3_max_record(rate: int, mode: str) -> Optional[float]:
|
||||||
|
top = S3_MAX_RECORD_S.get(rate)
|
||||||
|
if top is None:
|
||||||
|
return None
|
||||||
|
return min(top, S3_COMBO_MAX_RECORD_S) if mode == "histogram_continuous" else top
|
||||||
|
|
||||||
|
|
||||||
|
def _unit_string(c: bytes) -> List[str]:
|
||||||
|
return [c[_ch(k) + _CH_UNIT.start:_ch(k) + _CH_UNIT.stop].replace(b"\x00", b"")
|
||||||
|
.replace(b".", b"").decode("ascii", "replace") for k in _GEOPHONES]
|
||||||
|
|
||||||
|
|
||||||
|
def editable_fields(content: bytes, series: int) -> List[Dict[str, Any]]:
|
||||||
|
"""The fields an operator can change, described for a form: field, label,
|
||||||
|
kind ("number" / "choice" / "text" / "bool"), value, and as relevant unit,
|
||||||
|
min, max, step, choices [{value, label}], maxlength, readonly."""
|
||||||
|
c = content
|
||||||
|
rate = int.from_bytes(c[_SAMPLE_RATE], "big")
|
||||||
|
mode = _mode_name(c, series)
|
||||||
|
out: List[Dict[str, Any]] = [
|
||||||
|
{"field": "record_mode", "label": "Record mode", "kind": "choice", "value": mode,
|
||||||
|
"choices": [{"value": n, "label": _MODE_LABELS[n]} for n in MODES[series]]},
|
||||||
|
{"field": "sample_rate", "label": "Sample rate", "kind": "choice", "value": rate, "unit": "sps",
|
||||||
|
"choices": [{"value": r, "label": f"{r} sps"} for r in SAMPLE_RATES]},
|
||||||
|
{"field": "histogram_interval_s", "label": "Histogram interval", "kind": "choice",
|
||||||
|
"value": int.from_bytes(c[_HIST_INTERVAL], "big"),
|
||||||
|
"choices": [{"value": s, "label": f"{s} s" if s < 60 else f"{s // 60} min"} for s in INTERVALS]},
|
||||||
|
{"field": "record_time_s", "label": "Record time", "kind": "number", "unit": "s",
|
||||||
|
"value": _shown(_f32(c, _RECORD_TIME)), "min": RECORD_MIN_S,
|
||||||
|
"max": S4_MAX_RECORD_S if series == 4 else _s3_max_record(rate, mode)},
|
||||||
|
{"field": "geo_trigger_ips", "label": "Geophone trigger", "kind": "number", "unit": "in/s",
|
||||||
|
"value": _shown(_f32(c, _ch(0) + _CH_TRIGGER)), "min": TRIGGER_MIN,
|
||||||
|
"max": min(TRIGGER_MAX, _full_scale(c, series) or TRIGGER_MAX), "step": TRIGGER_STEP},
|
||||||
|
]
|
||||||
|
if series == 3:
|
||||||
|
code = _range_code(c)
|
||||||
|
name = next((n for n, v in _RANGES.items() if v == code), f"unknown(0x{code:02x})")
|
||||||
|
out.append({"field": "geo_range", "label": "Geophone range", "kind": "choice", "value": name,
|
||||||
|
"choices": [{"value": "normal", "label": "Normal (10 in/s)"},
|
||||||
|
{"value": "sensitive", "label": "Sensitive (1.25 in/s)"}]})
|
||||||
|
out.append({"field": "geo_alarm_ips", "label": "Geophone alarm", "kind": "number",
|
||||||
|
"unit": "in/s", "value": _shown(_f32(c, _ch(0) + _CH_ALARM)),
|
||||||
|
"min": TRIGGER_MIN, "max": _full_scale(c, 3) or TRIGGER_MAX,
|
||||||
|
"step": TRIGGER_STEP, "readonly": not S3_ALARM_WRITE_MEASURED})
|
||||||
|
out.append({"field": "job_number", "label": "Job number", "kind": "number",
|
||||||
|
"value": int.from_bytes(c[_JOB_NUMBER], "big"), "min": JOB_MIN, "max": JOB_MAX, "step": 1})
|
||||||
|
out.append({"field": "job_number_shown", "label": "Job number on report", "kind": "bool",
|
||||||
|
"value": bool(c[_REPORT_FLAGS] & _JOB_SHOWN)})
|
||||||
|
for n in range(_NOTES):
|
||||||
|
out.append({"field": f"note_{n + 1}", "label": _note_label(c, n), "kind": "text",
|
||||||
|
"value": _note_value(c, n), "maxlength": NOTE_MAX})
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def field_values(content: bytes, series: int) -> Dict[str, Any]:
|
||||||
|
return {d["field"]: d["value"] for d in editable_fields(content, series)}
|
||||||
|
|
||||||
|
|
||||||
|
def field_rows(before: bytes, written: bytes, series: int, fields, now: Optional[bytes] = None) -> Dict[str, Dict[str, Any]]:
|
||||||
|
"""For each changed field: its label, the value the unit had (old), the value
|
||||||
|
sent (new) and, given a read-back, what the unit now holds (now)."""
|
||||||
|
a, w = field_values(before, series), field_values(written, series)
|
||||||
|
n = field_values(now, series) if now is not None else None
|
||||||
|
labels = {d["field"]: d["label"] for d in editable_fields(written, series)}
|
||||||
|
out: Dict[str, Dict[str, Any]] = {}
|
||||||
|
for f in fields:
|
||||||
|
row: Dict[str, Any] = {"label": labels[f], "old": a[f], "new": w[f]}
|
||||||
|
if n is not None:
|
||||||
|
row["now"] = n[f]
|
||||||
|
out[f] = row
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
# ── Checking ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def _number(field: str, v: Any) -> float:
|
||||||
|
if isinstance(v, bool) or not isinstance(v, (int, float)) or not math.isfinite(v):
|
||||||
|
raise SettingsValueError(f"{field} must be a number, not {v!r}")
|
||||||
|
return float(v)
|
||||||
|
|
||||||
|
|
||||||
|
def _integer(field: str, v: Any) -> int:
|
||||||
|
if isinstance(v, bool) or not isinstance(v, int):
|
||||||
|
raise SettingsValueError(f"{field} must be a whole number, not {v!r}")
|
||||||
|
return v
|
||||||
|
|
||||||
|
|
||||||
|
def check_changes(content: bytes, series: int, changes: Dict[str, Any]) -> Dict[str, Any]:
|
||||||
|
"""The changes, normalised -- or SettingsValueError naming the first one SFM
|
||||||
|
will not make, and why. Checks names, types and the units' own limits, then
|
||||||
|
what depends on this unit's block: its unit strings and its range."""
|
||||||
|
if series not in _SERIES_FIELDS:
|
||||||
|
raise SettingsValueError(f"Series {series} has no settings SFM can change")
|
||||||
|
if not isinstance(changes, dict) or not changes:
|
||||||
|
raise SettingsValueError("no settings to change")
|
||||||
|
allowed = _SERIES_FIELDS[series]
|
||||||
|
out: Dict[str, Any] = {}
|
||||||
|
for field, v in changes.items():
|
||||||
|
if field not in allowed:
|
||||||
|
raise SettingsValueError(f"{field} is not a setting SFM can change on a Series {series} unit")
|
||||||
|
if field == "record_mode":
|
||||||
|
if v not in MODES[series]:
|
||||||
|
raise SettingsValueError(f"record_mode must be one of {', '.join(MODES[series])}, not {v!r}")
|
||||||
|
out[field] = v
|
||||||
|
elif field == "sample_rate":
|
||||||
|
if _integer(field, v) not in SAMPLE_RATES:
|
||||||
|
raise SettingsValueError(f"sample_rate must be one of {SAMPLE_RATES}, not {v}")
|
||||||
|
out[field] = v
|
||||||
|
elif field == "histogram_interval_s":
|
||||||
|
if _integer(field, v) not in INTERVALS:
|
||||||
|
raise SettingsValueError(f"histogram_interval_s must be one of {INTERVALS} s, not {v}")
|
||||||
|
out[field] = v
|
||||||
|
elif field == "geo_range":
|
||||||
|
if v not in _RANGES:
|
||||||
|
raise SettingsValueError(f"geo_range must be normal or sensitive, not {v!r}")
|
||||||
|
out[field] = v
|
||||||
|
elif field in ("geo_trigger_ips", "geo_alarm_ips"):
|
||||||
|
if field == "geo_alarm_ips" and not S3_ALARM_WRITE_MEASURED:
|
||||||
|
raise SettingsValueError("the alarm level is shown but not changed yet: a MiniMate "
|
||||||
|
"alarm write has never been measured (the bench measures it)")
|
||||||
|
x = _number(field, v)
|
||||||
|
if not TRIGGER_MIN <= x <= TRIGGER_MAX:
|
||||||
|
raise SettingsValueError(f"{field} must be {TRIGGER_MIN}-{TRIGGER_MAX} in/s, not {x}")
|
||||||
|
if abs(x - round(x, 3)) > 1e-9:
|
||||||
|
raise SettingsValueError(f"{field} must be in steps of {TRIGGER_STEP} in/s, not {x}")
|
||||||
|
out[field] = round(x, 3)
|
||||||
|
elif field == "record_time_s":
|
||||||
|
out[field] = _number(field, v)
|
||||||
|
elif field == "job_number":
|
||||||
|
if not JOB_MIN <= _integer(field, v) <= JOB_MAX:
|
||||||
|
raise SettingsValueError(f"job_number must be {JOB_MIN}-{JOB_MAX}, not {v}")
|
||||||
|
out[field] = v
|
||||||
|
elif field == "job_number_shown":
|
||||||
|
if not isinstance(v, bool):
|
||||||
|
raise SettingsValueError(f"job_number_shown must be true or false, not {v!r}")
|
||||||
|
out[field] = v
|
||||||
|
else: # note_1 .. note_4
|
||||||
|
if not isinstance(v, str):
|
||||||
|
raise SettingsValueError(f"{field} must be text, not {v!r}")
|
||||||
|
if any(not 0x20 <= ord(ch) <= 0x7E for ch in v):
|
||||||
|
raise SettingsValueError(f"{field} must be plain printable ASCII (no accents, tabs or "
|
||||||
|
"line breaks)")
|
||||||
|
if len(v) > NOTE_MAX:
|
||||||
|
raise SettingsValueError(f"{field} is {len(v)} characters; the unit holds {NOTE_MAX}")
|
||||||
|
out[field] = v
|
||||||
|
|
||||||
|
# What depends on this unit's block, with the NEW mode / rate / range if they change
|
||||||
|
# too -- checked on the block that would RESULT, so a one-field change (the range,
|
||||||
|
# the rate, the mode) cannot leave a value the unit already holds over its limit
|
||||||
|
# (final review, 2026-11-03).
|
||||||
|
c = content
|
||||||
|
if any(f in out for f in ("record_time_s", "sample_rate", "record_mode")):
|
||||||
|
t = out.get("record_time_s", _shown(_f32(c, _RECORD_TIME)))
|
||||||
|
held = "" if "record_time_s" in out else f" (the unit holds {t:g} s; change the record time too)"
|
||||||
|
if series == 4:
|
||||||
|
top: Optional[float] = S4_MAX_RECORD_S
|
||||||
|
else:
|
||||||
|
rate = out.get("sample_rate", int.from_bytes(c[_SAMPLE_RATE], "big"))
|
||||||
|
top = _s3_max_record(rate, out.get("record_mode", _mode_name(c, series)))
|
||||||
|
if top is None:
|
||||||
|
raise SettingsValueError(f"this unit's sample rate ({rate}) has no record-time limit "
|
||||||
|
"in the manual -- set the sample rate too")
|
||||||
|
if not RECORD_MIN_S <= t <= top:
|
||||||
|
raise SettingsValueError(f"record_time_s must be {RECORD_MIN_S}-{top:g} s here, not {t}{held}")
|
||||||
|
if any(f in out for f in (*_LEVELS, "geo_range")):
|
||||||
|
units = _unit_string(c)
|
||||||
|
if any(u != "in" for u in units):
|
||||||
|
raise SettingsValueError(f"this unit's geophone channels read {units}, not in/s -- only "
|
||||||
|
"in/s is measured, so SFM will not change a level or the range")
|
||||||
|
full = _full_scale(c, series, out.get("geo_range"))
|
||||||
|
if full is None:
|
||||||
|
raise SettingsValueError("this unit's geophone range byte is not a value ever measured")
|
||||||
|
held_levels = {"geo_trigger_ips": _CH_TRIGGER, "geo_alarm_ips": _CH_ALARM}
|
||||||
|
for f in _LEVELS:
|
||||||
|
if f not in _SERIES_FIELDS[series]:
|
||||||
|
continue
|
||||||
|
v = out.get(f, _shown(_f32(c, _ch(0) + held_levels[f])))
|
||||||
|
if v > full:
|
||||||
|
held = "" if f in out else " (the unit holds it)"
|
||||||
|
raise SettingsValueError(f"{f} {v} in/s is above the range's full scale ({full} in/s){held}")
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
# ── Writing ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def encode_setup(content: bytes, series: int, changes: Dict[str, Any]) -> bytes:
|
||||||
|
"""`content` with only the changed fields' bytes moved. `changes` should
|
||||||
|
come from check_changes; this patches, it does not judge. Bit fields are
|
||||||
|
patched bit by bit. Series 3 also writes Blastware's fixed bytes; Series 4
|
||||||
|
gets its checksum recomputed."""
|
||||||
|
out = bytearray(content)
|
||||||
|
for field, v in changes.items():
|
||||||
|
if field == "record_mode":
|
||||||
|
out[_MODE] = MODES[series][v]
|
||||||
|
elif field == "sample_rate":
|
||||||
|
out[_SAMPLE_RATE] = int(v).to_bytes(2, "big")
|
||||||
|
elif field == "histogram_interval_s":
|
||||||
|
out[_HIST_INTERVAL] = int(v).to_bytes(2, "big")
|
||||||
|
elif field == "record_time_s":
|
||||||
|
struct.pack_into(">f", out, _RECORD_TIME, float(v))
|
||||||
|
elif field == "geo_trigger_ips":
|
||||||
|
for k in _GEOPHONES:
|
||||||
|
struct.pack_into(">f", out, _ch(k) + _CH_TRIGGER, float(v))
|
||||||
|
elif field == "geo_alarm_ips":
|
||||||
|
for k in _GEOPHONES:
|
||||||
|
struct.pack_into(">f", out, _ch(k) + _CH_ALARM, float(v))
|
||||||
|
elif field == "geo_range":
|
||||||
|
for k in _GEOPHONES:
|
||||||
|
out[_ch(k) + _CH_RANGE] = _RANGES[v]
|
||||||
|
elif field == "job_number":
|
||||||
|
out[_JOB_NUMBER] = int(v).to_bytes(2, "big")
|
||||||
|
elif field == "job_number_shown":
|
||||||
|
out[_REPORT_FLAGS] = (out[_REPORT_FLAGS] | _JOB_SHOWN) if v else (out[_REPORT_FLAGS] & ~_JOB_SHOWN)
|
||||||
|
elif field.startswith("note_") and field[5:].isdigit() and 1 <= int(field[5:]) <= _NOTES:
|
||||||
|
_, start = _note_offsets(int(field[5:]) - 1)
|
||||||
|
out[start:start + _NOTE_WIDTH] = v.encode("ascii").ljust(_NOTE_WIDTH, b"\x00")
|
||||||
|
else:
|
||||||
|
raise SettingsValueError(f"{field} is not a setting SFM can change")
|
||||||
|
if series == 3:
|
||||||
|
for offset, value in S3_BLASTWARE_FIXED.items():
|
||||||
|
out[offset:offset + len(value)] = value
|
||||||
|
return bytes(out)
|
||||||
|
return with_crc(bytes(out))
|
||||||
|
|
||||||
|
|
||||||
|
# ── Reading back ────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
_COMPARED = 2090
|
||||||
|
|
||||||
|
|
||||||
|
def settings_state(before: bytes, written: bytes, now: bytes, *, series: int) -> str:
|
||||||
|
"""What a read of the unit says about a change, from the bytes alone:
|
||||||
|
"as asked" (it holds what was written), "unchanged" (it holds what it had),
|
||||||
|
or "differs". Floats are never compared -- 0.3 is the same f32 both ways.
|
||||||
|
Series 4 also needs the unit's own checksum to hold. Series 3 bytes that
|
||||||
|
differ only in Blastware's fixed bytes count as as asked: nothing the operator
|
||||||
|
asked for is different."""
|
||||||
|
a, w, n = before[:_COMPARED], written[:_COMPARED], now[:_COMPARED]
|
||||||
|
if series == 4 and not crc_ok(now):
|
||||||
|
return "differs"
|
||||||
|
if n == w:
|
||||||
|
return "as asked"
|
||||||
|
if series == 3:
|
||||||
|
fixed = {o + i for o, v in S3_BLASTWARE_FIXED.items() for i in range(len(v))}
|
||||||
|
if len(n) == len(w) and all(n[i] == w[i] for i in range(len(n)) if i not in fixed):
|
||||||
|
return "as asked"
|
||||||
|
if n == a:
|
||||||
|
return "unchanged"
|
||||||
|
return "differs"
|
||||||
|
|
||||||
|
|
||||||
|
def revision(blocks: List[bytes]) -> str:
|
||||||
|
"""A short fingerprint of the blocks a preview read; a live change must match it."""
|
||||||
|
return hashlib.sha256(b"".join(bytes(b) for b in blocks)).hexdigest()[:16]
|
||||||
|
|
||||||
|
|
||||||
|
def changes_bytes(changes: Dict[str, Any]) -> bytes:
|
||||||
|
"""The normalised changes, canonically: part of a preview's revision, so a live
|
||||||
|
change must ask for exactly what was previewed (final review, 2026-11-03)."""
|
||||||
|
import json
|
||||||
|
return json.dumps(changes, sort_keys=True, separators=(",", ":")).encode("ascii")
|
||||||
+9
-6
@@ -22,6 +22,7 @@ from .opcodes import CROSS_SERIES_COLLISIONS, WRITE_SUBS, OpcodeRefused
|
|||||||
from .setup_block import crc_ok
|
from .setup_block import crc_ok
|
||||||
|
|
||||||
_CONFIRM = 0xFFFF
|
_CONFIRM = 0xFFFF
|
||||||
|
_CALL_HOME_OBSERVED = (0x00, 0x01, 0x04, 0x05) # content[5] values units have held
|
||||||
|
|
||||||
# block content sizes THOR's offsets were observed at (all on UM12947 / 11.0CB)
|
# block content sizes THOR's offsets were observed at (all on UM12947 / 11.0CB)
|
||||||
_PREFS_LEN, _TRIGGER_LEN, _SETUP_LEN, _CALL_HOME_LEN = 90, 28, 2092, 126
|
_PREFS_LEN, _TRIGGER_LEN, _SETUP_LEN, _CALL_HOME_LEN = 90, 28, 2092, 126
|
||||||
@@ -113,9 +114,10 @@ def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
|
|||||||
|
|
||||||
Bit 0 of `[5]` is the enable. 🔶 UM12947 (THOR's unit) read 0x05 enabled /
|
Bit 0 of `[5]` is the enable. 🔶 UM12947 (THOR's unit) read 0x05 enabled /
|
||||||
0x04 disabled, bit 2 set in both; UM20147 reads 0x01 (measured, phase-2 dry
|
0x04 disabled, bit 2 set in both; UM20147 reads 0x01 (measured, phase-2 dry
|
||||||
run). So on UM20147 "off" writes 0x00, a value no capture shows being
|
run). So on UM20147 "off" writes 0x00 -- measured at the bench 2026-11-03
|
||||||
written: the target value there is unobserved, and the plan's `warnings`
|
(and again 11-04): 0x01 <-> 0x00 acknowledged, read back, and matched in the
|
||||||
say so. `[118:120]` is unit-maintained and THOR echoes it.
|
unit's own menu. A value outside those four still carries a warning.
|
||||||
|
`[118:120]` is unit-maintained and THOR echoes it.
|
||||||
"""
|
"""
|
||||||
if len(call_home) != _CALL_HOME_LEN:
|
if len(call_home) != _CALL_HOME_LEN:
|
||||||
raise ValueError(f"call-home content must be {_CALL_HOME_LEN} B "
|
raise ValueError(f"call-home content must be {_CALL_HOME_LEN} B "
|
||||||
@@ -128,9 +130,10 @@ def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
|
|||||||
what = "call-home " + ("enable" if enabled else "disable")
|
what = "call-home " + ("enable" if enabled else "disable")
|
||||||
start = call_home[5]
|
start = call_home[5]
|
||||||
warnings = []
|
warnings = []
|
||||||
if start not in (0x04, 0x05) or b5 not in (0x04, 0x05):
|
if start not in _CALL_HOME_OBSERVED or b5 not in _CALL_HOME_OBSERVED:
|
||||||
warnings.append(f"content[5] 0x{start:02X} -> 0x{b5:02X}: THOR was only ever "
|
warnings.append(f"content[5] 0x{start:02X} -> 0x{b5:02X}: no unit has been seen "
|
||||||
"seen writing 0x04/0x05 (UM12947); this value is unobserved")
|
"holding this value (0x04/0x05 UM12947 by THOR, 0x00/0x01 UM20147 "
|
||||||
|
"by SFM); it is unobserved")
|
||||||
if b5 == start:
|
if b5 == start:
|
||||||
warnings.append(f"the unit is already call-home {'enabled' if enabled else 'disabled'}"
|
warnings.append(f"the unit is already call-home {'enabled' if enabled else 'disabled'}"
|
||||||
" -- this write changes nothing")
|
" -- this write changes nothing")
|
||||||
|
|||||||
+17
-271
@@ -3,7 +3,8 @@ blastware_file.py — Blastware binary file codec for bidirectional interoperabi
|
|||||||
|
|
||||||
Reads and writes the proprietary Instantel/Blastware file formats:
|
Reads and writes the proprietary Instantel/Blastware file formats:
|
||||||
Waveform events (.CE0W, .VM0H, .440, .7M0, etc.) (extension encoding UNKNOWN — see below)
|
Waveform events (.CE0W, .VM0H, .440, .7M0, etc.) (extension encoding UNKNOWN — see below)
|
||||||
.MLG — Monitor log (monitoring session history)
|
|
||||||
|
Monitor logs (.MLG) live in minimateplus/mlg_file.py (reader and writer, 2026-11-13).
|
||||||
|
|
||||||
All waveform formats share a common 22-byte file header prefix and identical
|
All waveform formats share a common 22-byte file header prefix and identical
|
||||||
internal binary structure (same type tag 00 12 03 00, same STRT record layout).
|
internal binary structure (same type tag 00 12 03 00, same STRT record layout).
|
||||||
@@ -61,27 +62,6 @@ Waveform file structure (confirmed from example-events/4-3-26-multi/M529LIY6 (ex
|
|||||||
Timestamp format (big-endian, 8 bytes):
|
Timestamp format (big-endian, 8 bytes):
|
||||||
[day] [month] [year_HI] [year_LO] [0x00] [hour] [min] [sec]
|
[day] [month] [year_HI] [year_LO] [0x00] [hour] [min] [sec]
|
||||||
|
|
||||||
MLG (monitor log, confirmed from example-events/4-3-26-multi/BE11529.MLG):
|
|
||||||
|
|
||||||
[308B header] [N × 292B records]
|
|
||||||
|
|
||||||
Header (308 bytes):
|
|
||||||
Offset 0x00: 10 00 01 80 00 00 Instantel\x00 07 2c 22 01 0e a0 — fixed (16B)
|
|
||||||
Offset 0x10: ... (unknown structure, written as zeros + serial)
|
|
||||||
Offset 0x2A: serial number (8 bytes, null-padded ASCII, e.g. "BE11529")
|
|
||||||
... zero-padded to 308 bytes total
|
|
||||||
|
|
||||||
Record (292 bytes each):
|
|
||||||
[2B CRC] — unknown algorithm; written as 0x00 0x00
|
|
||||||
22 01 0e 80 — record marker
|
|
||||||
[ts1: 8B big-endian timestamp] — start time
|
|
||||||
[ts2: 8B big-endian timestamp] — stop time (zeros if no stop)
|
|
||||||
[4B flags] — see MLG_FLAGS_* constants below
|
|
||||||
[10B serial] — null-padded serial number ASCII
|
|
||||||
[text] — for trigger records: [0x08][8B ts1_copy] then ASCII "Geo: X.XXX in/s"
|
|
||||||
for monitoring records: b'' (or minimal separator)
|
|
||||||
[zero-padded to 292 bytes]
|
|
||||||
|
|
||||||
─── Critical implementation notes ──────────────────────────────────────────────
|
─── Critical implementation notes ──────────────────────────────────────────────
|
||||||
|
|
||||||
Waveform body reconstruction algorithm (confirmed 2026-04-21 from verification against
|
Waveform body reconstruction algorithm (confirmed 2026-04-21 from verification against
|
||||||
@@ -104,25 +84,11 @@ M529LIY6 (example event) using raw_s3_20260403_153508.bin capture):
|
|||||||
DLE strip rule (applied AFTER slicing):
|
DLE strip rule (applied AFTER slicing):
|
||||||
Strip any 0x10 byte that is immediately followed by 0x02, 0x03, or 0x04.
|
Strip any 0x10 byte that is immediately followed by 0x02, 0x03, or 0x04.
|
||||||
This undoes the DLE-escape that S3FrameParser preserves as literal pairs.
|
This undoes the DLE-escape that S3FrameParser preserves as literal pairs.
|
||||||
Applied to frame.data[skip:] + bytes([frame.chk_byte]) together, then
|
|
||||||
conditionally exclude the trailing chk_byte from the output.
|
|
||||||
|
|
||||||
chk_byte absorption:
|
chk_byte absorption (retired 2026-11-06, #58):
|
||||||
When frame.data[-1] == 0x10 AND frame.chk_byte ∈ {0x02, 0x03, 0x04},
|
The escape 0x10 of a checksum sent as `10 02/03/04` used to stay at the end
|
||||||
the last byte of frame.data is the DLE prefix of a split DLE+chk pair.
|
of frame.data, and this builder dropped it here. The parser now drops it,
|
||||||
Including chk_byte in the strip buffer allows the pair to be stripped as
|
so a 0x10 ending frame.data is real data (one A5 chunk in ten ends in one).
|
||||||
a unit. After stripping, the trailing chk_byte is ALWAYS removed — because
|
|
||||||
_strip_inner_frame_dles keeps the byte after the DLE (the chk_byte value),
|
|
||||||
and that value is the checksum, never payload. This applies to all three
|
|
||||||
cases (chk ∈ {0x02, 0x03, 0x04}) identically.
|
|
||||||
|
|
||||||
MLG CRC:
|
|
||||||
The algorithm that produces the 2-byte CRC at the start of each MLG record
|
|
||||||
is unknown. All examined records use non-zero values that do not match
|
|
||||||
CRC-16/CCITT, CRC-16/IBM, CRC-32 (truncated), word sums, XOR variants, or
|
|
||||||
any of the 40+ polynomial/init combinations tested. The writer emits 0x0000.
|
|
||||||
This produces files that Blastware may reject or display without the CRC check —
|
|
||||||
the exact impact on BW import is unknown (TODO: test).
|
|
||||||
|
|
||||||
─── Public API ──────────────────────────────────────────────────────────────────
|
─── Public API ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -139,13 +105,6 @@ MLG CRC:
|
|||||||
read_blastware_file(path) → Event
|
read_blastware_file(path) → Event
|
||||||
Parse a Blastware waveform file into an Event object with waveform data populated.
|
Parse a Blastware waveform file into an Event object with waveform data populated.
|
||||||
(Not yet implemented — placeholder raises NotImplementedError.)
|
(Not yet implemented — placeholder raises NotImplementedError.)
|
||||||
|
|
||||||
write_mlg(entries, serial, path)
|
|
||||||
Create a .MLG file from a list of MonitorLogEntry objects.
|
|
||||||
|
|
||||||
read_mlg(path) → list[MonitorLogEntry]
|
|
||||||
Parse a .MLG file into MonitorLogEntry objects.
|
|
||||||
(Not yet implemented — placeholder raises NotImplementedError.)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -158,7 +117,7 @@ from pathlib import Path
|
|||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
from .framing import S3Frame
|
from .framing import S3Frame
|
||||||
from .models import Event, MonitorLogEntry, Timestamp
|
from .models import Event, Timestamp
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -175,9 +134,6 @@ _FILE_HEADER_PREFIX = b"\x10\x00\x01\x80\x00\x00Instantel\x00\x07\x2c" # 17 byt
|
|||||||
# Waveform file type tag (4 bytes after common prefix) — shared by ALL waveform extensions
|
# Waveform file type tag (4 bytes after common prefix) — shared by ALL waveform extensions
|
||||||
_WAVEFORM_TYPE_TAG = b"\x00\x12\x03\x00" # confirmed from M529LIY6 (example event) — same tag for .CE0W, .VM0H, etc.
|
_WAVEFORM_TYPE_TAG = b"\x00\x12\x03\x00" # confirmed from M529LIY6 (example event) — same tag for .CE0W, .VM0H, etc.
|
||||||
|
|
||||||
# MLG type tag (4 bytes after common prefix)
|
|
||||||
_MLG_TYPE_TAG = b"\x22\x01\x0e\xa0" # confirmed from BE11529.MLG offset 0x11..0x14
|
|
||||||
|
|
||||||
# Total header sizes
|
# Total header sizes
|
||||||
_WAVEFORM_HEADER_SIZE = 22 # 17 + 4 = 21... wait. Let me recalculate.
|
_WAVEFORM_HEADER_SIZE = 22 # 17 + 4 = 21... wait. Let me recalculate.
|
||||||
# From binary: first 22 bytes = header, then STRT at byte 22.
|
# From binary: first 22 bytes = header, then STRT at byte 22.
|
||||||
@@ -186,17 +142,6 @@ _WAVEFORM_HEADER_SIZE = 22 # 17 + 4 = 21... wait. Let me recalculate.
|
|||||||
# Re-count: b"\x10\x00\x01\x80\x00\x00" = 6B + b"Instantel\x00" = 10B + b"\x07\x2c" = 2B = 18B prefix.
|
# Re-count: b"\x10\x00\x01\x80\x00\x00" = 6B + b"Instantel\x00" = 10B + b"\x07\x2c" = 2B = 18B prefix.
|
||||||
_FILE_HEADER_PREFIX = b"\x10\x00\x01\x80\x00\x00Instantel\x00\x07\x2c" # 18 bytes
|
_FILE_HEADER_PREFIX = b"\x10\x00\x01\x80\x00\x00Instantel\x00\x07\x2c" # 18 bytes
|
||||||
_WAVEFORM_HEADER_SIZE = 22 # 18 + 4 = 22 bytes ✅
|
_WAVEFORM_HEADER_SIZE = 22 # 18 + 4 = 22 bytes ✅
|
||||||
_MLG_HEADER_SIZE = 308 # confirmed from BE11529.MLG
|
|
||||||
|
|
||||||
# MLG record marker (4 bytes after 2-byte CRC at start of each record)
|
|
||||||
_MLG_RECORD_MARKER = b"\x22\x01\x0e\x80"
|
|
||||||
_MLG_RECORD_SIZE = 292 # bytes per record (confirmed from BE11529.MLG)
|
|
||||||
|
|
||||||
# MLG record flags (4 bytes at record[22:26])
|
|
||||||
# Confirmed from BE11529.MLG binary inspection:
|
|
||||||
MLG_FLAGS_START_ONLY = b"\xff\xff\x00\x00" # monitoring start with no stop
|
|
||||||
MLG_FLAGS_TRIGGER = b"\x01\x00\x02\x00" # triggered event (has ts1 + ts2)
|
|
||||||
MLG_FLAGS_INTERVAL = b"\x02\x00\x00\x00" # monitoring interval (has ts1 + ts2)
|
|
||||||
|
|
||||||
|
|
||||||
# ── Timestamp helpers ─────────────────────────────────────────────────────────
|
# ── Timestamp helpers ─────────────────────────────────────────────────────────
|
||||||
@@ -205,7 +150,8 @@ def _encode_ts_be(ts: Optional[datetime.datetime]) -> bytes:
|
|||||||
"""
|
"""
|
||||||
Encode a datetime as an 8-byte big-endian Blastware timestamp.
|
Encode a datetime as an 8-byte big-endian Blastware timestamp.
|
||||||
|
|
||||||
Format (waveform file and MLG record timestamps):
|
Format (event file timestamps; an .MLG stores the year little-endian,
|
||||||
|
see minimateplus/mlg_file.py):
|
||||||
[day][month][year_HI][year_LO][0x00][hour][min][sec]
|
[day][month][year_HI][year_LO][0x00][hour][min][sec]
|
||||||
|
|
||||||
Big-endian year confirmed from M529LIY6 (example event) footer:
|
Big-endian year confirmed from M529LIY6 (example event) footer:
|
||||||
@@ -297,29 +243,16 @@ def _frame_body_bytes(frame: S3Frame, skip: int) -> bytes:
|
|||||||
Extract the waveform body contribution from one A5 S3Frame.
|
Extract the waveform body contribution from one A5 S3Frame.
|
||||||
|
|
||||||
The contribution is frame.data[skip:] with inner-frame DLE pairs stripped
|
The contribution is frame.data[skip:] with inner-frame DLE pairs stripped
|
||||||
per _strip_inner_frame_dles(). The chk_byte is temporarily appended before
|
per _strip_inner_frame_dles().
|
||||||
stripping to handle the split-pair edge case where a DLE at the end of
|
|
||||||
frame.data is paired with chk_byte.
|
|
||||||
|
|
||||||
Split-pair edge case (confirmed for A5[8] of M529LIY6 (example event), 2026-04-21):
|
Until #58 (2026-11-06) an escaped checksum (`10 02/03/04`) left its 0x10 as
|
||||||
|
the last byte of frame.data, and this function dropped it by pairing it with
|
||||||
S3FrameParser appends DLE+XX pairs as two literal bytes when XX ∉ {DLE, ETX}.
|
chk_byte (first seen on A5[8] of M529LIY6, 2026-04-21). The parser drops it
|
||||||
When the LAST occurrence of such a pair straddles the payload/checksum boundary
|
now, so a 0x10 here is data and is kept.
|
||||||
(i.e., DLE is the last byte of raw_payload and XX is the checksum), the parser
|
|
||||||
splits them:
|
|
||||||
- DLE ends up as the last byte of frame.data (frame.data[-1] == 0x10)
|
|
||||||
- XX is stored as frame.chk_byte
|
|
||||||
|
|
||||||
To strip the pair correctly, we reunite the bytes before calling the strip
|
|
||||||
function. Since chk_byte is the checksum (not payload data), it is excluded
|
|
||||||
from the final output regardless of whether it was part of a pair.
|
|
||||||
|
|
||||||
Post-strip chk_byte removal (ALL cases):
|
|
||||||
_strip_inner_frame_dles strips the 0x10 and KEEPS chk_byte in all cases.
|
|
||||||
Chk_byte is always the checksum (not payload), so always strip it off.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
frame: S3Frame with frame.data and frame.chk_byte populated.
|
frame: S3Frame from S3FrameParser (or a store pickle loaded by
|
||||||
|
WaveformStore.load_a5, which converts pre-#58 frames).
|
||||||
skip: Number of leading bytes in frame.data to exclude (frame header).
|
skip: Number of leading bytes in frame.data to exclude (frame header).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@@ -327,28 +260,7 @@ def _frame_body_bytes(frame: S3Frame, skip: int) -> bytes:
|
|||||||
"""
|
"""
|
||||||
if skip >= len(frame.data):
|
if skip >= len(frame.data):
|
||||||
return b""
|
return b""
|
||||||
|
return _strip_inner_frame_dles(frame.data[skip:])
|
||||||
relevant = frame.data[skip:]
|
|
||||||
|
|
||||||
# Detect split DLE+chk pair at the frame boundary.
|
|
||||||
has_split_pair = (
|
|
||||||
len(relevant) > 0
|
|
||||||
and relevant[-1] == 0x10
|
|
||||||
and frame.chk_byte in {0x02, 0x03, 0x04}
|
|
||||||
)
|
|
||||||
|
|
||||||
if has_split_pair:
|
|
||||||
# Reunite the split pair so the strip function sees both bytes together.
|
|
||||||
buf = relevant + bytes([frame.chk_byte])
|
|
||||||
stripped = _strip_inner_frame_dles(buf)
|
|
||||||
# _strip_inner_frame_dles strips the DLE (0x10) and KEEPS chk_byte.
|
|
||||||
# chk_byte is the received checksum — never payload — so remove it.
|
|
||||||
# This is correct for all values in {0x02, 0x03, 0x04}.
|
|
||||||
if stripped:
|
|
||||||
stripped = stripped[:-1]
|
|
||||||
return stripped
|
|
||||||
else:
|
|
||||||
return _strip_inner_frame_dles(relevant)
|
|
||||||
|
|
||||||
|
|
||||||
# ── Filename helper ───────────────────────────────────────────────────────────
|
# ── Filename helper ───────────────────────────────────────────────────────────
|
||||||
@@ -976,169 +888,3 @@ def read_blastware_file(path: Union[str, Path]) -> Event:
|
|||||||
NotImplementedError: always (pending implementation).
|
NotImplementedError: always (pending implementation).
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError("read_blastware_file() is not yet implemented")
|
raise NotImplementedError("read_blastware_file() is not yet implemented")
|
||||||
|
|
||||||
|
|
||||||
# ── MLG file writer ───────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
def _build_mlg_header(serial: str) -> bytes:
|
|
||||||
"""
|
|
||||||
Build the 308-byte MLG file header.
|
|
||||||
|
|
||||||
Header structure (confirmed from BE11529.MLG binary inspection):
|
|
||||||
Offset 0x00: 10 00 01 80 00 00 Instantel\x00 07 2c 22 01 0e a0 (22B)
|
|
||||||
Offset 0x16: ... (16B unknown — observed as zeros in BE11529.MLG)
|
|
||||||
Offset 0x2A: serial number (8 bytes, null-padded ASCII)
|
|
||||||
... rest zero-padded to 308 bytes
|
|
||||||
|
|
||||||
The serial string "BE11529" appears at offset 0x2A (42 decimal).
|
|
||||||
"""
|
|
||||||
buf = bytearray(_MLG_HEADER_SIZE)
|
|
||||||
|
|
||||||
# Common prefix + MLG type tag
|
|
||||||
prefix = _FILE_HEADER_PREFIX + _MLG_TYPE_TAG # 22 bytes
|
|
||||||
buf[0:len(prefix)] = prefix
|
|
||||||
|
|
||||||
# Serial number at offset 0x2A
|
|
||||||
serial_bytes = serial.encode("ascii", errors="replace")[:8]
|
|
||||||
serial_padded = serial_bytes.ljust(8, b"\x00")
|
|
||||||
buf[0x2A : 0x2A + 8] = serial_padded
|
|
||||||
|
|
||||||
return bytes(buf)
|
|
||||||
|
|
||||||
|
|
||||||
def _build_mlg_record(
|
|
||||||
entry: MonitorLogEntry,
|
|
||||||
serial: str,
|
|
||||||
) -> bytes:
|
|
||||||
"""
|
|
||||||
Build one 292-byte MLG record from a MonitorLogEntry.
|
|
||||||
|
|
||||||
Record layout (confirmed from BE11529.MLG binary inspection):
|
|
||||||
[0:2] CRC — 2-byte CRC (algorithm unknown; written as 0x0000)
|
|
||||||
[2:6] marker — 22 01 0e 80
|
|
||||||
[6:14] ts1 — 8B big-endian start timestamp
|
|
||||||
[14:22] ts2 — 8B big-endian stop timestamp
|
|
||||||
[22:26] flags — 4B record flags (see MLG_FLAGS_* constants)
|
|
||||||
[26:36] serial — 10B null-padded serial number
|
|
||||||
[36:] text — for triggered events: [0x08][8B ts1_copy]["Geo: X.XXX in/s"]
|
|
||||||
for monitoring intervals: b"" or minimal separator
|
|
||||||
[... zero-padded to 292 bytes]
|
|
||||||
|
|
||||||
Flags based on entry type:
|
|
||||||
- MonitorLogEntry with start_time only (no stop_time): MLG_FLAGS_START_ONLY
|
|
||||||
- MonitorLogEntry with both times and geo_threshold_ips set: MLG_FLAGS_TRIGGER
|
|
||||||
- MonitorLogEntry with both times (monitoring interval): MLG_FLAGS_INTERVAL
|
|
||||||
|
|
||||||
The triggered-event text block (flags = MLG_FLAGS_TRIGGER):
|
|
||||||
[0x08] [ts1: 8B] [ASCII "Geo: X.XXX in/s\x00"]
|
|
||||||
Confirmed from BE11529.MLG records at offset 0x0134 and 0x0258.
|
|
||||||
"""
|
|
||||||
buf = bytearray(_MLG_RECORD_SIZE)
|
|
||||||
|
|
||||||
start_dt = (
|
|
||||||
datetime.datetime(
|
|
||||||
entry.start_time.year, entry.start_time.month, entry.start_time.day,
|
|
||||||
entry.start_time.hour, entry.start_time.minute, entry.start_time.second,
|
|
||||||
)
|
|
||||||
if entry.start_time else None
|
|
||||||
)
|
|
||||||
stop_dt = (
|
|
||||||
datetime.datetime(
|
|
||||||
entry.stop_time.year, entry.stop_time.month, entry.stop_time.day,
|
|
||||||
entry.stop_time.hour, entry.stop_time.minute, entry.stop_time.second,
|
|
||||||
)
|
|
||||||
if entry.stop_time else None
|
|
||||||
)
|
|
||||||
|
|
||||||
# [0:2] CRC placeholder
|
|
||||||
buf[0:2] = b"\x00\x00"
|
|
||||||
|
|
||||||
# [2:6] Record marker
|
|
||||||
buf[2:6] = _MLG_RECORD_MARKER
|
|
||||||
|
|
||||||
# [6:14] ts1
|
|
||||||
buf[6:14] = _encode_ts_be(start_dt)
|
|
||||||
|
|
||||||
# [14:22] ts2
|
|
||||||
buf[14:22] = _encode_ts_be(stop_dt)
|
|
||||||
|
|
||||||
# [22:26] flags
|
|
||||||
if stop_dt is None:
|
|
||||||
flags = MLG_FLAGS_START_ONLY
|
|
||||||
elif entry.geo_threshold_ips is not None:
|
|
||||||
flags = MLG_FLAGS_TRIGGER
|
|
||||||
else:
|
|
||||||
flags = MLG_FLAGS_INTERVAL
|
|
||||||
buf[22:26] = flags
|
|
||||||
|
|
||||||
# [26:36] serial (10B null-padded)
|
|
||||||
serial_bytes = serial.encode("ascii", errors="replace")[:10]
|
|
||||||
buf[26 : 26 + len(serial_bytes)] = serial_bytes
|
|
||||||
|
|
||||||
# [36:] text content
|
|
||||||
pos = 36
|
|
||||||
if flags == MLG_FLAGS_TRIGGER:
|
|
||||||
# Extra ts1 copy: [0x08][ts1: 8B]
|
|
||||||
buf[pos] = 0x08
|
|
||||||
pos += 1
|
|
||||||
buf[pos : pos + 8] = _encode_ts_be(start_dt)
|
|
||||||
pos += 8
|
|
||||||
|
|
||||||
if entry.geo_threshold_ips is not None:
|
|
||||||
geo_text = f"Geo: {entry.geo_threshold_ips:.3f} in/s\x00".encode("ascii")
|
|
||||||
buf[pos : pos + len(geo_text)] = geo_text
|
|
||||||
pos += len(geo_text)
|
|
||||||
|
|
||||||
return bytes(buf)
|
|
||||||
|
|
||||||
|
|
||||||
def write_mlg(
|
|
||||||
entries: list[MonitorLogEntry],
|
|
||||||
serial: str,
|
|
||||||
path: Union[str, Path],
|
|
||||||
) -> None:
|
|
||||||
"""
|
|
||||||
Write a Blastware .MLG monitor log file.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
entries: List of MonitorLogEntry objects (from get_monitor_log_entries()).
|
|
||||||
Each entry produces one 292-byte record in the file.
|
|
||||||
serial: Device serial number string (e.g. "BE11529").
|
|
||||||
Written to the file header and each record.
|
|
||||||
path: Destination file path. Extension is not enforced — use ".MLG".
|
|
||||||
|
|
||||||
File layout:
|
|
||||||
[308B header] [N × 292B records]
|
|
||||||
|
|
||||||
Note: The 2-byte CRC at the start of each record is written as 0x0000.
|
|
||||||
The CRC algorithm is unknown (see module docstring).
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
OSError: if the file cannot be written.
|
|
||||||
"""
|
|
||||||
path = Path(path)
|
|
||||||
header = _build_mlg_header(serial)
|
|
||||||
|
|
||||||
with open(path, "wb") as f:
|
|
||||||
f.write(header)
|
|
||||||
for entry in entries:
|
|
||||||
record = _build_mlg_record(entry, serial)
|
|
||||||
f.write(record)
|
|
||||||
|
|
||||||
|
|
||||||
def read_mlg(path: Union[str, Path]) -> list[MonitorLogEntry]:
|
|
||||||
"""
|
|
||||||
Parse a Blastware .MLG file into a list of MonitorLogEntry objects.
|
|
||||||
|
|
||||||
NOT YET IMPLEMENTED.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
path: Path to the .MLG file.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List of MonitorLogEntry objects.
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
NotImplementedError: always (pending implementation).
|
|
||||||
"""
|
|
||||||
raise NotImplementedError("read_mlg() is not yet implemented")
|
|
||||||
+36
-378
@@ -70,15 +70,8 @@ S3_MONITORING_FLAGS = frozenset({0x10, 0x0B})
|
|||||||
# ⚠ RETRACTED 2026-10-27 (#46): a trigger block "hardcoded from 3-11-26 -- no
|
# ⚠ RETRACTED 2026-10-27 (#46): a trigger block "hardcoded from 3-11-26 -- no
|
||||||
# read exists, Blastware writes this fixed blob". Blastware reads it first (SUB
|
# read exists, Blastware writes this fixed blob". Blastware reads it first (SUB
|
||||||
# 0x2E), and its byte 5 differs by unit and session (01 / 03 / 04 on record), so
|
# 0x2E), and its byte 5 differs by unit and session (01 / 03 / 04 on record), so
|
||||||
# the copy changed that setting on any unit that differed. apply_config reads
|
# the copy changed that setting on any unit that differed. A settings write sends
|
||||||
# the unit's own block (MiniMateProtocol.read_trigger_config).
|
# the unit's own block back (sfm.device_access.s3 change_settings, phase 5).
|
||||||
|
|
||||||
# Compliance ASCII slot format (confirmed from 3-11-26 capture + label search):
|
|
||||||
# Each label occupies a 64-byte slot.
|
|
||||||
# Value starts at slot_start + 22, max 42 bytes, null-padded.
|
|
||||||
_COMPLIANCE_SLOT_SIZE = 64
|
|
||||||
_COMPLIANCE_VALUE_OFFSET = 22
|
|
||||||
_COMPLIANCE_VALUE_MAX = _COMPLIANCE_SLOT_SIZE - _COMPLIANCE_VALUE_OFFSET # 42
|
|
||||||
|
|
||||||
|
|
||||||
# ── MiniMateClient ────────────────────────────────────────────────────────────
|
# ── MiniMateClient ────────────────────────────────────────────────────────────
|
||||||
@@ -922,6 +915,8 @@ class MiniMateClient:
|
|||||||
compliance_data: bytes,
|
compliance_data: bytes,
|
||||||
trigger_data: bytes,
|
trigger_data: bytes,
|
||||||
waveform_data: bytes,
|
waveform_data: bytes,
|
||||||
|
*,
|
||||||
|
escaped: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Push a complete config update to the device using the confirmed write
|
Push a complete config update to the device using the confirmed write
|
||||||
@@ -949,6 +944,10 @@ class MiniMateClient:
|
|||||||
trigger_data: Raw bytes for SUB 82 write (44-byte trigger config).
|
trigger_data: Raw bytes for SUB 82 write (44-byte trigger config).
|
||||||
waveform_data: Raw bytes for SUB 69 write.
|
waveform_data: Raw bytes for SUB 69 write.
|
||||||
|
|
||||||
|
`escaped`: False (the default) -- the blocks are logical, as every block
|
||||||
|
read returns them since phase 5; True for blocks that still hold the
|
||||||
|
parser's kept escape bytes.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
RuntimeError: if the client is not connected.
|
RuntimeError: if the client is not connected.
|
||||||
ProtocolError: if any write step fails (timeout, bad ack SUB).
|
ProtocolError: if any write step fails (timeout, bad ack SUB).
|
||||||
@@ -960,32 +959,36 @@ class MiniMateClient:
|
|||||||
# 2026-10-27): a block refused after 68 + 73 had been sent left a partial
|
# 2026-10-27): a block refused after 68 + 73 had been sent left a partial
|
||||||
# write behind. write_image is the same check each write makes.
|
# write behind. write_image is the same check each write makes.
|
||||||
from .protocol import (SUB_COMPLIANCE_WRITE, SUB_EVENT_INDEX_WRITE,
|
from .protocol import (SUB_COMPLIANCE_WRITE, SUB_EVENT_INDEX_WRITE,
|
||||||
SUB_TRIGGER_CONFIG_WRITE, SUB_WAVEFORM_DATA_WRITE, write_image)
|
SUB_TRIGGER_CONFIG_WRITE, SUB_WAVEFORM_DATA_WRITE, ImageRefused,
|
||||||
|
write_image)
|
||||||
for sub, data in ((SUB_EVENT_INDEX_WRITE, event_index_data),
|
for sub, data in ((SUB_EVENT_INDEX_WRITE, event_index_data),
|
||||||
(SUB_COMPLIANCE_WRITE, compliance_data),
|
(SUB_COMPLIANCE_WRITE, compliance_data),
|
||||||
(SUB_TRIGGER_CONFIG_WRITE, trigger_data),
|
(SUB_TRIGGER_CONFIG_WRITE, trigger_data),
|
||||||
(SUB_WAVEFORM_DATA_WRITE, waveform_data)):
|
(SUB_WAVEFORM_DATA_WRITE, waveform_data)):
|
||||||
write_image(sub, data)
|
try:
|
||||||
|
write_image(sub, data, escaped=escaped)
|
||||||
|
except ValueError as exc: # refused before any frame: the caller audits "nothing sent"
|
||||||
|
raise ImageRefused(str(exc)) from exc
|
||||||
|
|
||||||
# 68 → 73
|
# 68 → 73
|
||||||
log.info("push_config_raw: write event index (SUB 68)")
|
log.info("push_config_raw: write event index (SUB 68)")
|
||||||
proto.write_event_index(event_index_data)
|
proto.write_event_index(event_index_data, escaped=escaped)
|
||||||
log.info("push_config_raw: confirm B (SUB 73)")
|
log.info("push_config_raw: confirm B (SUB 73)")
|
||||||
proto.write_confirm(SUB_WRITE_CONFIRM_B)
|
proto.write_confirm(SUB_WRITE_CONFIRM_B)
|
||||||
|
|
||||||
# 71×3 → 72 (handled internally by write_compliance_config_raw)
|
# 71×3 → 72 (handled internally by write_compliance_config_raw)
|
||||||
log.info("push_config_raw: write compliance config (SUB 71 ×3 + confirm 72)")
|
log.info("push_config_raw: write compliance config (SUB 71 ×3 + confirm 72)")
|
||||||
proto.write_compliance_config_raw(compliance_data)
|
proto.write_compliance_config_raw(compliance_data, escaped=escaped)
|
||||||
|
|
||||||
# 82 → 83
|
# 82 → 83
|
||||||
log.info("push_config_raw: write trigger config (SUB 82)")
|
log.info("push_config_raw: write trigger config (SUB 82)")
|
||||||
proto.write_trigger_config(trigger_data)
|
proto.write_trigger_config(trigger_data, escaped=escaped)
|
||||||
log.info("push_config_raw: trigger confirm (SUB 83)")
|
log.info("push_config_raw: trigger confirm (SUB 83)")
|
||||||
proto.write_confirm(SUB_TRIGGER_CONFIRM)
|
proto.write_confirm(SUB_TRIGGER_CONFIRM)
|
||||||
|
|
||||||
# 69 → 74 → 72
|
# 69 → 74 → 72
|
||||||
log.info("push_config_raw: write waveform data (SUB 69)")
|
log.info("push_config_raw: write waveform data (SUB 69)")
|
||||||
proto.write_waveform_data(waveform_data)
|
proto.write_waveform_data(waveform_data, escaped=escaped)
|
||||||
log.info("push_config_raw: confirm C (SUB 74)")
|
log.info("push_config_raw: confirm C (SUB 74)")
|
||||||
proto.write_confirm(SUB_WRITE_CONFIRM_C)
|
proto.write_confirm(SUB_WRITE_CONFIRM_C)
|
||||||
log.info("push_config_raw: confirm A (SUB 72)")
|
log.info("push_config_raw: confirm A (SUB 72)")
|
||||||
@@ -993,120 +996,6 @@ class MiniMateClient:
|
|||||||
|
|
||||||
log.info("push_config_raw: complete")
|
log.info("push_config_raw: complete")
|
||||||
|
|
||||||
def apply_config(
|
|
||||||
self,
|
|
||||||
*,
|
|
||||||
# Recording parameters
|
|
||||||
recording_mode: Optional[int] = None,
|
|
||||||
sample_rate: Optional[int] = None,
|
|
||||||
record_time: Optional[float] = None,
|
|
||||||
histogram_interval_sec: Optional[int] = None,
|
|
||||||
# Threshold parameters (geo channels, in/s)
|
|
||||||
trigger_level_geo: Optional[float] = None,
|
|
||||||
alarm_level_geo: Optional[float] = None,
|
|
||||||
geo_range: Optional[int] = None, # 0x00=Normal 10in/s, 0x01=Sensitive 1.25in/s
|
|
||||||
# Project / operator strings
|
|
||||||
project: Optional[str] = None,
|
|
||||||
client_name: Optional[str] = None,
|
|
||||||
operator: Optional[str] = None,
|
|
||||||
seis_loc: Optional[str] = None,
|
|
||||||
notes: Optional[str] = None,
|
|
||||||
) -> None:
|
|
||||||
"""
|
|
||||||
Read the current device config, apply any supplied changes to the
|
|
||||||
compliance block, and write the full config back to the device.
|
|
||||||
|
|
||||||
Only non-None arguments are modified; all other bytes are round-tripped
|
|
||||||
verbatim from the device.
|
|
||||||
|
|
||||||
Configurable fields
|
|
||||||
-------------------
|
|
||||||
Recording parameters:
|
|
||||||
recording_mode : int — 0x00=Single Shot, 0x01=Continuous, 0x03=Histogram, 0x04=Histogram+Continuous
|
|
||||||
sample_rate : int — samples/sec; valid values: 1024, 2048, 4096
|
|
||||||
record_time : float — record duration in seconds (e.g. 2.0, 3.0)
|
|
||||||
|
|
||||||
Trigger/alarm thresholds and range (geo channels):
|
|
||||||
trigger_level_geo : float — trigger threshold in/s (e.g. 0.5)
|
|
||||||
alarm_level_geo : float — alarm threshold in/s (e.g. 1.0)
|
|
||||||
geo_range : int — 0x00=Normal 10.000 in/s, 0x01=Sensitive 1.250 in/s
|
|
||||||
(written to Tran/Vert/Long channel blocks)
|
|
||||||
|
|
||||||
Project / operator strings (max 41 ASCII characters each):
|
|
||||||
project : str
|
|
||||||
client_name : str
|
|
||||||
operator : str
|
|
||||||
seis_loc : str — sensor location
|
|
||||||
notes : str — extended notes
|
|
||||||
|
|
||||||
Write sequence (confirmed from 3-11-26 BW TX capture):
|
|
||||||
68→73 | 71×3→72 | 82→83 | 69→74→72
|
|
||||||
|
|
||||||
Write payloads:
|
|
||||||
event_index_data : 88 bytes — read live via SUB 08
|
|
||||||
compliance_data : ~2128 bytes — read live via SUB 1A (~2126 bytes, varies ±1-2) + \\x00\\x00 footer
|
|
||||||
trigger_data : 26 bytes — read live via SUB 2E (was hard-coded; #46)
|
|
||||||
waveform_data : 204 bytes — read live via SUB 09
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
RuntimeError: if not connected.
|
|
||||||
ProtocolError: if any read or write step fails.
|
|
||||||
ValueError: if compliance buffer is shorter than the 2082-byte write minimum.
|
|
||||||
"""
|
|
||||||
proto = self._require_proto()
|
|
||||||
|
|
||||||
# 1. Read current payloads from the device
|
|
||||||
log.info("apply_config: reading event index (SUB 08)")
|
|
||||||
event_index_data = proto.read_event_index()
|
|
||||||
|
|
||||||
log.info("apply_config: reading compliance config (SUB 1A)")
|
|
||||||
compliance_raw = proto.read_compliance_config() # ~2126 bytes (varies ±1-2 by DLE jitter)
|
|
||||||
|
|
||||||
log.info("apply_config: reading waveform data (SUB 09)")
|
|
||||||
waveform_data = proto.read_waveform_data_raw() # 204 bytes
|
|
||||||
|
|
||||||
log.info("apply_config: reading trigger config (SUB 2E)")
|
|
||||||
trigger_data = proto.read_trigger_config() # 26 bytes, this unit's own
|
|
||||||
|
|
||||||
# 2. Patch the compliance buffer and build the 2128-byte write payload
|
|
||||||
compliance_data = _encode_compliance_config(
|
|
||||||
compliance_raw,
|
|
||||||
recording_mode=recording_mode,
|
|
||||||
sample_rate=sample_rate,
|
|
||||||
record_time=record_time,
|
|
||||||
histogram_interval_sec=histogram_interval_sec,
|
|
||||||
trigger_level_geo=trigger_level_geo,
|
|
||||||
alarm_level_geo=alarm_level_geo,
|
|
||||||
geo_range=geo_range,
|
|
||||||
project=project,
|
|
||||||
client_name=client_name,
|
|
||||||
operator=operator,
|
|
||||||
seis_loc=seis_loc,
|
|
||||||
notes=notes,
|
|
||||||
)
|
|
||||||
log.info("apply_config: compliance payload ready (%d bytes)", len(compliance_data))
|
|
||||||
|
|
||||||
# 3. Push the full write sequence to the device
|
|
||||||
self.push_config_raw(event_index_data, compliance_data, trigger_data, waveform_data)
|
|
||||||
log.info("apply_config: complete")
|
|
||||||
|
|
||||||
def set_project_info(
|
|
||||||
self,
|
|
||||||
project: Optional[str] = None,
|
|
||||||
client_name: Optional[str] = None,
|
|
||||||
operator: Optional[str] = None,
|
|
||||||
seis_loc: Optional[str] = None,
|
|
||||||
notes: Optional[str] = None,
|
|
||||||
) -> None:
|
|
||||||
"""Backwards-compat shim — delegates to apply_config()."""
|
|
||||||
self.apply_config(
|
|
||||||
project=project,
|
|
||||||
client_name=client_name,
|
|
||||||
operator=operator,
|
|
||||||
seis_loc=seis_loc,
|
|
||||||
notes=notes,
|
|
||||||
)
|
|
||||||
|
|
||||||
# ── Call home config ──────────────────────────────────────────────────────
|
# ── Call home config ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
def get_call_home_config(self) -> CallHomeConfig:
|
def get_call_home_config(self) -> CallHomeConfig:
|
||||||
@@ -1132,6 +1021,21 @@ class MiniMateClient:
|
|||||||
read-modify-write (`call_home_image`)."""
|
read-modify-write (`call_home_image`)."""
|
||||||
return self._require_proto().read_call_home_config()
|
return self._require_proto().read_call_home_config()
|
||||||
|
|
||||||
|
def read_compliance_content(self) -> bytes:
|
||||||
|
"""The 1A settings read as the logical 2,090-byte block, unjudged (a
|
||||||
|
monitoring unit's device-info answer comes back as it is; see
|
||||||
|
`minimateplus.protocol.is_compliance_content`)."""
|
||||||
|
return self._require_proto().read_compliance_content()
|
||||||
|
|
||||||
|
def read_settings_blocks(self) -> dict:
|
||||||
|
"""The four blocks a settings write sends back, each as its read returns it:
|
||||||
|
event index (08), settings (1A, logical), trigger (2E), waveform data (09)."""
|
||||||
|
proto = self._require_proto()
|
||||||
|
return {"event_index": proto.read_event_index(),
|
||||||
|
"compliance": proto.read_compliance_content(),
|
||||||
|
"trigger": proto.read_trigger_config(),
|
||||||
|
"waveform": proto.read_waveform_data_raw()}
|
||||||
|
|
||||||
def write_call_home_image(self, image: bytes) -> None:
|
def write_call_home_image(self, image: bytes) -> None:
|
||||||
"""Send a `0x7E` image (`call_home_image`) and its `0x7F` confirm, each ack
|
"""Send a `0x7E` image (`call_home_image`) and its `0x7F` confirm, each ack
|
||||||
checked -- framed once, never unescaped again. Raises ImageRefused before
|
checked -- framed once, never unescaped again. Raises ImageRefused before
|
||||||
@@ -2108,253 +2012,6 @@ def _extract_project_strings(data: bytes) -> Optional[ProjectInfo]:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _encode_compliance_config(
|
|
||||||
raw: bytes,
|
|
||||||
*,
|
|
||||||
recording_mode: Optional[int] = None,
|
|
||||||
sample_rate: Optional[int] = None,
|
|
||||||
record_time: Optional[float] = None,
|
|
||||||
trigger_level_geo: Optional[float] = None,
|
|
||||||
alarm_level_geo: Optional[float] = None,
|
|
||||||
geo_range: Optional[int] = None, # 0x00=Normal 10in/s, 0x01=Sensitive 1.25in/s
|
|
||||||
histogram_interval_sec: Optional[int] = None,
|
|
||||||
project: Optional[str] = None,
|
|
||||||
client_name: Optional[str] = None,
|
|
||||||
operator: Optional[str] = None,
|
|
||||||
seis_loc: Optional[str] = None,
|
|
||||||
notes: Optional[str] = None,
|
|
||||||
) -> bytes:
|
|
||||||
"""
|
|
||||||
Patch a live 2126-byte compliance buffer (read from the device) with any
|
|
||||||
supplied field values and return the 2128-byte write payload.
|
|
||||||
|
|
||||||
Only non-None arguments are modified; everything else is round-tripped verbatim.
|
|
||||||
|
|
||||||
Numeric field locations (all anchor-relative or label-relative — immune to
|
|
||||||
DLE-jitter shifts):
|
|
||||||
|
|
||||||
Anchor: b'\\xbe\\x80\\x00\\x00\\x00\\x00' (confirmed stable, both BE11529 and BE18189)
|
|
||||||
⚠ 2026-10-29: these RAW offsets were measured at 1024 sps, where the escape
|
|
||||||
before `04` sits between the mode and the anchor. The decoder now reads
|
|
||||||
the four fields after unescaping (mode -7, rate -6, interval -4, record
|
|
||||||
time +6), so at any other layout these patch the wrong bytes. Until the
|
|
||||||
encoder is rewritten on unescaped bytes (#46), a payload whose four fields
|
|
||||||
do not read back as asked raises ValueError -- see the end of this function.
|
|
||||||
recording_mode → uint8 at anchor_pos - 8 (raw; right at 1024 sps only)
|
|
||||||
Values: 0x00=Single Shot, 0x01=Continuous, 0x03=Histogram, 0x04=Histogram+Continuous
|
|
||||||
NOTE: The byte at anchor_pos - 7 is always 0x10 (a DLE marker regenerated by
|
|
||||||
device firmware in every E5 response). It must NOT be overwritten during
|
|
||||||
write — doing so causes anchor drift (+1 per write cycle).
|
|
||||||
CORRECTION 2026-04-21: previous doc stated anchor-7 for write; empirically
|
|
||||||
confirmed wrong — writing to anchor-7 shifts the anchor by 1 on every cycle.
|
|
||||||
sample_rate → uint16 BE at anchor_pos - 6
|
|
||||||
histogram_interval_sec → uint16 BE at anchor_pos - 4 (seconds; mode-gated to Histogram/Histogram+Continuous)
|
|
||||||
Valid values: 2, 5, 15, 60, 300, 900 (= 2s, 5s, 15s, 1m, 5m, 15m)
|
|
||||||
record_time → float32 BE at anchor_pos + 6
|
|
||||||
|
|
||||||
Channel block (anchored on b"Tran" with unit-string guard):
|
|
||||||
geo_range → uint8 at tran_pos + 33 (confirmed 2026-04-20)
|
|
||||||
0x00 = Normal 10.000 in/s, 0x01 = Sensitive 1.250 in/s
|
|
||||||
Written to Tran, Vert, Long channel blocks (all three).
|
|
||||||
adc_scale_factor → float32 BE at tran_pos + 28 (= 6.206053; do NOT write)
|
|
||||||
trigger_level_geo → float32 BE at tran_pos + 34
|
|
||||||
"in.\\x00" → unit string at tran_pos + 38 (layout guard)
|
|
||||||
alarm_level_geo → float32 BE at tran_pos + 42
|
|
||||||
"/s\\x00\\x00" → unit string at tran_pos + 46 (layout guard)
|
|
||||||
NOTE: tran_pos+28 (float32 = 6.206053) is the ADC-to-velocity scale factor
|
|
||||||
(= 1/sensitivity, (in/s)/V — Interface Handbook §4.5: 1.61133 V × 6.206053 = 10.000 in/s).
|
|
||||||
This is a hardware/firmware constant common to all MiniMate Plus S3 units.
|
|
||||||
It must NOT be written — do not add it back as a parameter.
|
|
||||||
|
|
||||||
String field locations (64-byte slots, label+22 format):
|
|
||||||
b"Project:" → value at label_pos + 22, max 41 chars + null
|
|
||||||
b"Client:" → value at label_pos + 22, max 41 chars + null
|
|
||||||
b"User Name:" → value at label_pos + 22, max 41 chars + null
|
|
||||||
b"Seis Loc:" → value at label_pos + 22, max 41 chars + null
|
|
||||||
b"Extended Notes"→ value at label_pos + 22, max 41 chars + null
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
2128-byte write payload: patched 2126-byte buffer + 2-byte footer \\x00\\x00.
|
|
||||||
(Checksum formula for the footer is unknown; \\x00\\x00 confirmed accepted
|
|
||||||
by the device in POC test 2026-04-07.)
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
ValueError: if raw is shorter than the minimum needed for the 3-chunk write.
|
|
||||||
"""
|
|
||||||
# Total size is nominally ~2126 bytes but varies by ±1-2 bytes depending on
|
|
||||||
# DLE jitter in the E5 read response (0x10 bytes in the config data cause
|
|
||||||
# 1-byte expansions per occurrence during DLE stuffing/unstuffing). The
|
|
||||||
# anchor-based field access and the chunk splitter (fixed chunk1=1027,
|
|
||||||
# chunk2=1055, chunk3=remainder) both handle variable length correctly.
|
|
||||||
# Only enforce a minimum — must have at least chunk1+chunk2 bytes of content.
|
|
||||||
_MIN_COMPLIANCE_LEN = 1027 + 1055 # = 2082
|
|
||||||
if len(raw) < _MIN_COMPLIANCE_LEN:
|
|
||||||
raise ValueError(
|
|
||||||
f"_encode_compliance_config: compliance buffer too short "
|
|
||||||
f"({len(raw)} bytes, need at least {_MIN_COMPLIANCE_LEN})"
|
|
||||||
)
|
|
||||||
if len(raw) not in range(2124, 2132):
|
|
||||||
log.warning(
|
|
||||||
"_encode_compliance_config: unusual compliance buffer length %d "
|
|
||||||
"(expected ~2126); proceeding with anchor-based access",
|
|
||||||
len(raw),
|
|
||||||
)
|
|
||||||
|
|
||||||
buf = bytearray(raw)
|
|
||||||
|
|
||||||
# ── Numeric: recording_mode + sample_rate + record_time (anchor-relative) ──
|
|
||||||
_ANC = b'\xbe\x80\x00\x00\x00\x00'
|
|
||||||
_anc = buf.find(_ANC, 0, 150)
|
|
||||||
|
|
||||||
# Log anchor position every time so we can detect unexpected shifts due to
|
|
||||||
# DLE jitter or firmware differences. Expected position is ~15.
|
|
||||||
if _anc < 0:
|
|
||||||
log.warning(
|
|
||||||
"_encode_compliance_config: anchor NOT FOUND in cfg[0:150] "
|
|
||||||
"(buf len=%d) — all anchor-relative writes will be skipped",
|
|
||||||
len(buf),
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
log.info(
|
|
||||||
"_encode_compliance_config: anchor at cfg[%d] buf_len=%d "
|
|
||||||
"(recording_mode@%d DLE_marker@%d sample_rate@%d:%d "
|
|
||||||
"histogram_interval@%d:%d record_time@%d:%d)",
|
|
||||||
_anc, len(buf),
|
|
||||||
_anc - 8,
|
|
||||||
_anc - 7,
|
|
||||||
_anc - 6, _anc - 4,
|
|
||||||
_anc - 4, _anc - 2,
|
|
||||||
_anc + 6, _anc + 10,
|
|
||||||
)
|
|
||||||
|
|
||||||
if recording_mode is not None:
|
|
||||||
if _anc < 8:
|
|
||||||
log.warning("_encode_compliance_config: anchor not found — cannot write recording_mode")
|
|
||||||
else:
|
|
||||||
# Write to anchor-8, same physical position as the E5 read format.
|
|
||||||
# The byte at anchor-7 is a DLE marker (0x10) that the device firmware
|
|
||||||
# regenerates in every E5 response — it must NOT be overwritten.
|
|
||||||
# Writing to anchor-7 causes the device to add an extra byte on the
|
|
||||||
# next read-back, drifting the anchor by +1 on every write cycle.
|
|
||||||
# (CLAUDE.md "anchor-7 write" was incorrect — confirmed 2026-04-21)
|
|
||||||
buf[_anc - 8] = recording_mode & 0xFF
|
|
||||||
log.debug("_encode_compliance_config: recording_mode=0x%02X -> offset %d",
|
|
||||||
recording_mode, _anc - 8)
|
|
||||||
|
|
||||||
if sample_rate is not None:
|
|
||||||
if _anc < 6:
|
|
||||||
log.warning("_encode_compliance_config: anchor not found — cannot write sample_rate")
|
|
||||||
else:
|
|
||||||
struct.pack_into(">H", buf, _anc - 6, sample_rate)
|
|
||||||
log.debug("_encode_compliance_config: sample_rate=%d -> offset %d", sample_rate, _anc - 6)
|
|
||||||
|
|
||||||
if histogram_interval_sec is not None:
|
|
||||||
if _anc < 4:
|
|
||||||
log.warning("_encode_compliance_config: anchor not found — cannot write histogram_interval")
|
|
||||||
else:
|
|
||||||
struct.pack_into(">H", buf, _anc - 4, histogram_interval_sec)
|
|
||||||
log.debug("_encode_compliance_config: histogram_interval=%ds -> offset %d",
|
|
||||||
histogram_interval_sec, _anc - 4)
|
|
||||||
|
|
||||||
if record_time is not None:
|
|
||||||
if _anc < 0 or _anc + 10 > len(buf):
|
|
||||||
log.warning("_encode_compliance_config: anchor not found — cannot write record_time")
|
|
||||||
else:
|
|
||||||
struct.pack_into(">f", buf, _anc + 6, record_time)
|
|
||||||
log.debug("_encode_compliance_config: record_time=%.3f -> offset %d", record_time, _anc + 6)
|
|
||||||
|
|
||||||
# ── Numeric: channel block (Tran label + unit-string guard) ───────────────
|
|
||||||
# NOTE: tran_pos+24 (write format) or tran_pos+28 (E5 read format) is the
|
|
||||||
# ADC-to-velocity scale factor (6.206053, hardware constant — never written).
|
|
||||||
# geo_range is written to ALL THREE geo channel blocks (Tran, Vert, Long),
|
|
||||||
# confirmed from 4-20-26 captures showing the byte at label+29 in each block.
|
|
||||||
_needs_channel = any(v is not None for v in (trigger_level_geo, alarm_level_geo, geo_range))
|
|
||||||
if _needs_channel:
|
|
||||||
_tran = buf.find(b"Tran", 44)
|
|
||||||
_valid = (
|
|
||||||
_tran >= 0
|
|
||||||
and buf[_tran + 4 : _tran + 5] != b"2"
|
|
||||||
and _tran + 50 <= len(buf)
|
|
||||||
and buf[_tran + 38 : _tran + 42] == b"in.\x00"
|
|
||||||
and buf[_tran + 46 : _tran + 50] == b"/s\x00\x00"
|
|
||||||
)
|
|
||||||
if not _valid:
|
|
||||||
log.warning(
|
|
||||||
"_encode_compliance_config: 'Tran' channel block not found or unit "
|
|
||||||
"guard failed — trigger/alarm/geo_range will not be written"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
if trigger_level_geo is not None:
|
|
||||||
struct.pack_into(">f", buf, _tran + 34, trigger_level_geo)
|
|
||||||
log.debug("_encode_compliance_config: trigger_level_geo=%.4f -> offset %d", trigger_level_geo, _tran + 34)
|
|
||||||
if alarm_level_geo is not None:
|
|
||||||
struct.pack_into(">f", buf, _tran + 42, alarm_level_geo)
|
|
||||||
log.debug("_encode_compliance_config: alarm_level_geo=%.4f -> offset %d", alarm_level_geo, _tran + 42)
|
|
||||||
if geo_range is not None:
|
|
||||||
# Write geo_range to all three geo channel blocks (Tran, Vert, Long).
|
|
||||||
# Field at label+33 in the E5-format compliance bytes (same in read and write
|
|
||||||
# since the 2126-byte payload is round-tripped verbatim).
|
|
||||||
# 0x00 = Normal 10.000 in/s, 0x01 = Sensitive 1.250 in/s.
|
|
||||||
for _ch_label in (b"Tran", b"Vert", b"Long"):
|
|
||||||
_ch = buf.find(_ch_label, 44)
|
|
||||||
if _ch >= 0 and buf[_ch + 4 : _ch + 5] != b"2" and _ch + 34 <= len(buf):
|
|
||||||
buf[_ch + 33] = geo_range & 0xFF
|
|
||||||
log.debug(
|
|
||||||
"_encode_compliance_config: geo_range=0x%02X -> %s+33 offset %d",
|
|
||||||
geo_range, _ch_label.decode(), _ch + 33,
|
|
||||||
)
|
|
||||||
|
|
||||||
# ── ASCII strings (64-byte slot, value at label_pos+22) ───────────────────
|
|
||||||
def _set_string(label: bytes, value: Optional[str]) -> None:
|
|
||||||
if value is None:
|
|
||||||
return
|
|
||||||
idx = buf.find(label)
|
|
||||||
if idx < 0:
|
|
||||||
log.warning("_encode_compliance_config: label %r not found", label)
|
|
||||||
return
|
|
||||||
val_bytes = value.encode("ascii", errors="replace")[:_COMPLIANCE_VALUE_MAX - 1]
|
|
||||||
padded = val_bytes + b"\x00" * (_COMPLIANCE_VALUE_MAX - len(val_bytes))
|
|
||||||
buf[idx + _COMPLIANCE_VALUE_OFFSET : idx + _COMPLIANCE_SLOT_SIZE] = padded
|
|
||||||
log.debug("_encode_compliance_config: %r -> %r", label, value)
|
|
||||||
|
|
||||||
_set_string(b"Project:", project)
|
|
||||||
_set_string(b"Client:", client_name)
|
|
||||||
_set_string(b"User Name:", operator)
|
|
||||||
_set_string(b"Seis Loc:", seis_loc)
|
|
||||||
_set_string(b"Extended Notes", notes)
|
|
||||||
|
|
||||||
# ── Read-back check: the payload must decode to what was asked ────────────
|
|
||||||
# The decoder is the measured layout (every recorded reply); these offsets are
|
|
||||||
# 1024-sps raw ones. A mode change on BE9441's 10-25 Continuous / 4096 block
|
|
||||||
# rewrote the byte in front of the mode and read back unchanged. Refuse it
|
|
||||||
# here, before push_config_raw sends anything.
|
|
||||||
asked = {"recording_mode": recording_mode, "sample_rate": sample_rate,
|
|
||||||
"histogram_interval_sec": histogram_interval_sec, "record_time": record_time}
|
|
||||||
if any(v is not None for v in asked.values()):
|
|
||||||
before, after = _settings_read_back(raw), _settings_read_back(bytes(buf))
|
|
||||||
if record_time is not None:
|
|
||||||
asked["record_time"] = struct.unpack(">f", struct.pack(">f", record_time))[0]
|
|
||||||
want = {k: (v if v is not None else before[k]) for k, v in asked.items()}
|
|
||||||
wrong = {k: (after[k], want[k]) for k in asked if after[k] != want[k]}
|
|
||||||
if wrong:
|
|
||||||
raise ValueError(
|
|
||||||
"_encode_compliance_config: the patched block would not read back as asked ("
|
|
||||||
+ ", ".join(f"{k} reads {got!r}, not {exp!r}" for k, (got, exp) in wrong.items())
|
|
||||||
+ ") -- refused, nothing built or sent. The encoder's offsets were measured at "
|
|
||||||
"1024 sps and need rewriting on unescaped bytes (#46)."
|
|
||||||
)
|
|
||||||
|
|
||||||
# 2-byte footer — checksum formula unknown; \x00\x00 confirmed accepted by device
|
|
||||||
return bytes(buf) + b"\x00\x00"
|
|
||||||
|
|
||||||
|
|
||||||
def _settings_read_back(data: bytes) -> dict:
|
|
||||||
"""Mode, sample rate, interval and record time as the decoder reads `data`."""
|
|
||||||
info = DeviceInfo(serial="", firmware_minor=0)
|
|
||||||
_decode_compliance_config_into(data, info)
|
|
||||||
cc = info.compliance_config
|
|
||||||
return {k: getattr(cc, k, None) if cc is not None else None
|
|
||||||
for k in ("recording_mode", "sample_rate", "histogram_interval_sec", "record_time")}
|
|
||||||
|
|
||||||
|
|
||||||
def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None:
|
def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None:
|
||||||
@@ -2697,8 +2354,9 @@ def _decode_monitor_status(data: bytes) -> MonitorStatus:
|
|||||||
header, so field offsets below are relative to data[11]).
|
header, so field offsets below are relative to data[11]).
|
||||||
|
|
||||||
NOTE: frame.data has the checksum byte already stripped by S3FrameParser
|
NOTE: frame.data has the checksum byte already stripped by S3FrameParser
|
||||||
(_finalise returns raw_payload[5:] where raw_payload = body[:-1]).
|
(_finalise returns raw_payload[5:], the checksum and, since #58, the 10 of
|
||||||
There is NO trailing checksum byte in section.
|
an escaped checksum removed). There is NO trailing checksum byte in section;
|
||||||
|
before #58 one status reply in 63 kept that 10 and read 419.84 V.
|
||||||
|
|
||||||
Monitoring flag (confirmed 4-8-26/2ndtry, byte diff of all 144 data frames):
|
Monitoring flag (confirmed 4-8-26/2ndtry, byte diff of all 144 data frames):
|
||||||
section[1] == 0x00 → idle
|
section[1] == 0x00 → idle
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
"""
|
||||||
|
minimateplus/crc.py — Instantel's record checksum, shared by every reader that checks one.
|
||||||
|
|
||||||
|
CRC-16/AUG-CCITT: poly 0x1021, init 0x1D0F, no reflection, no final XOR. The
|
||||||
|
same rule covers a Micromate's setup blocks (0x1A, 0x08, 0x2E; stored big-endian),
|
||||||
|
a Blastware event file's footer (big-endian) and every .MLG record (little-endian).
|
||||||
|
Each block says where its checksum sits; this module only computes it.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
_POLY = 0x1021
|
||||||
|
_INIT = 0x1D0F
|
||||||
|
|
||||||
|
|
||||||
|
def crc16_aug_ccitt(data: bytes) -> int:
|
||||||
|
"""CRC-16/AUG-CCITT of `data` (check value: b"123456789" -> 0xE5CC)."""
|
||||||
|
c = _INIT
|
||||||
|
for b in data:
|
||||||
|
c ^= b << 8
|
||||||
|
for _ in range(8):
|
||||||
|
c = ((c << 1) ^ _POLY) & 0xFFFF if c & 0x8000 else (c << 1) & 0xFFFF
|
||||||
|
return c
|
||||||
+225
-29
@@ -13,13 +13,16 @@ Pure: no I/O, and no import from `sfm/`.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import math
|
||||||
import re
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass, field
|
||||||
from typing import Callable, Optional, Sequence
|
from typing import Callable, Optional, Sequence
|
||||||
|
|
||||||
from .bw_xml_report import XmlReport
|
from .bw_xml_report import XmlReport
|
||||||
from .event_file_io import (_GEO_FS_BY_RANGE, _GEO_INT16_FS, _GEO_NORMAL_FS_INS, _MIC_PSI_PER_COUNT,
|
from .event_file_io import (interval_times, _GEO_FS_BY_RANGE, _GEO_INT16_FS, _GEO_NORMAL_FS_INS, _MIC_PSI_PER_COUNT,
|
||||||
decode_blastware_bytes)
|
decode_blastware_bytes, mic_count_divisor, over_full_scale)
|
||||||
|
from .histogram_codec import half_period_to_hz
|
||||||
from .models import Event
|
from .models import Event
|
||||||
from .waveform_codec import mic_count_to_db
|
from .waveform_codec import mic_count_to_db
|
||||||
|
|
||||||
@@ -30,6 +33,50 @@ GEO_IPS_PER_COUNT: float = _GEO_NORMAL_FS_INS / _GEO_INT16_FS
|
|||||||
_CHANNELS = ("Tran", "Vert", "Long", "MicL")
|
_CHANNELS = ("Tran", "Vert", "Long", "MicL")
|
||||||
_EVENT_TYPE = {"Waveform": "Full Waveform", "Histogram": "Full Histogram"}
|
_EVENT_TYPE = {"Waveform": "Full Waveform", "Histogram": "Full Histogram"}
|
||||||
|
|
||||||
|
# How Blastware prints the setup fields SFM reads (measured 2026-11-03).
|
||||||
|
_MONTHS = ("January", "February", "March", "April", "May", "June", "July",
|
||||||
|
"August", "September", "October", "November", "December")
|
||||||
|
_TRIGGERED_BY = {0x0001: "Tran", 0x0002: "Vert", 0x0004: "Long", 0x0008: "MicL", 0x0200: "Manual"}
|
||||||
|
_STOP_MODES = {0: "Fixed"}
|
||||||
|
_MIC_TYPES = {2: "Linear Weighting"}
|
||||||
|
_GEO_TRIGGERS, _MIC_TRIGGER = 0x07, 0x08
|
||||||
|
# Blastware turns the mic trigger level from psi to dB with 6895 Pa per psi, not
|
||||||
|
# 6894.757: 4,272 / 4,272 DL2 levels against 4,271 (the odd one 0.01 psi,
|
||||||
|
# printed 130.8 dB(L), is 130.7498 at the exact constant).
|
||||||
|
_TRIGGER_PA_PER_PSI = 6895.0
|
||||||
|
|
||||||
|
|
||||||
|
def _setup_values(ev: Event) -> dict[str, object]:
|
||||||
|
out: dict[str, object] = {}
|
||||||
|
di = ev.device_info
|
||||||
|
if di is not None:
|
||||||
|
out["SerialNumber"] = di.serial
|
||||||
|
fw = di.firmware_version or ""
|
||||||
|
if di.dsp_version and fw.startswith("S33") and di.model:
|
||||||
|
# "V 10.72-8.17 MiniMate Plus" from "10.72", "S338.17" and the model --
|
||||||
|
# the only version in DL2, so the rule is proven for it alone.
|
||||||
|
out["Version"] = f"V {di.dsp_version}-{fw[3:]} {di.model}"
|
||||||
|
if di.calibration_date and di.calibrated_by:
|
||||||
|
c = di.calibration_date
|
||||||
|
out["Calibration"] = f"{_MONTHS[c.month - 1]} {c.day}, {c.year} by {di.calibrated_by}"
|
||||||
|
out["BatteryLevel"] = ev.battery_volts
|
||||||
|
out["Trigger"] = _TRIGGERED_BY.get(ev.triggered_by)
|
||||||
|
out["RecordStopMode"] = _STOP_MODES.get(ev.record_stop_mode)
|
||||||
|
out["Microphone"] = _MIC_TYPES.get(ev.mic_type)
|
||||||
|
# dB or psi is Blastware's preference, not the unit's (carve-out
|
||||||
|
# units-is-a-display-preference); SFM reports dB, the default.
|
||||||
|
out["Units"] = "in/s and dB(L)" if ev.mic_type is not None else "in/s"
|
||||||
|
# Blastware prints a trigger level only for a channel that is a trigger
|
||||||
|
# source, and none for a Manual trigger.
|
||||||
|
src, manual = ev.trigger_sources or 0, ev.triggered_by == 0x0200
|
||||||
|
if src & _GEO_TRIGGERS and not manual:
|
||||||
|
out["GeoTriggerLevel"] = ev.trigger_level_geo
|
||||||
|
if src & _MIC_TRIGGER and not manual and ev.trigger_level_mic_psi:
|
||||||
|
psi = ev.trigger_level_mic_psi
|
||||||
|
out["MicTriggerLevel psi(L)"] = psi
|
||||||
|
out["MicTriggerLevel dB(L)"] = 20 * math.log10(psi * _TRIGGER_PA_PER_PSI / 2e-5)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class SfmSide:
|
class SfmSide:
|
||||||
@@ -40,6 +87,28 @@ class SfmSide:
|
|||||||
channels: list[str] # channels with decoded data, in Tran/Vert/Long/MicL order
|
channels: list[str] # channels with decoded data, in Tran/Vert/Long/MicL order
|
||||||
counts: dict[str, list[int]] # waveform samples or histogram interval peaks
|
counts: dict[str, list[int]] # waveform samples or histogram interval peaks
|
||||||
geo_ips_per_count: float = GEO_IPS_PER_COUNT # at the event's range, as SFM read it
|
geo_ips_per_count: float = GEO_IPS_PER_COUNT # at the event's range, as SFM read it
|
||||||
|
mic_divisor: int = 1 # mic counts per 0.25 Pa, at the mic's range
|
||||||
|
# interval column -> SFM's value per interval (a number, or Blastware's word)
|
||||||
|
interval_values: dict[str, list[object]] = field(default_factory=dict)
|
||||||
|
interval_times: Optional[list[str]] = None # each interval's printed time
|
||||||
|
|
||||||
|
|
||||||
|
def interval_frequency(halfp: int, sample_rate: int) -> object:
|
||||||
|
"""An interval's frequency as Blastware prints it: "N/A" for a half-period
|
||||||
|
of 0, ">100" (">200" at 2048 sps) at 5 samples or fewer, "<1.0" below 1 Hz,
|
||||||
|
else (sample rate / 2) / half-period in Hz. Measured on ~3.1 M DL2 cells,
|
||||||
|
2026-11-03 (#50: the rate, not a fixed 512)."""
|
||||||
|
if halfp == 0:
|
||||||
|
return "N/A"
|
||||||
|
hz = half_period_to_hz(halfp, sample_rate)
|
||||||
|
if hz is None:
|
||||||
|
return f">{round(100 * sample_rate / 1024)}"
|
||||||
|
return "<1.0" if hz < 1.0 else hz
|
||||||
|
|
||||||
|
|
||||||
|
def _interval_size(seconds: int) -> str:
|
||||||
|
n, unit = (seconds // 60, "minute") if seconds % 60 == 0 else (seconds, "second")
|
||||||
|
return f"{n} {unit}{'' if n == 1 else 's'}"
|
||||||
|
|
||||||
|
|
||||||
def sfm_side(raw: bytes) -> SfmSide:
|
def sfm_side(raw: bytes) -> SfmSide:
|
||||||
@@ -69,9 +138,77 @@ def sfm_side(raw: bytes) -> SfmSide:
|
|||||||
if pv is not None:
|
if pv is not None:
|
||||||
values.update(TranPPV=pv.tran, VertPPV=pv.vert, LongPPV=pv.long,
|
values.update(TranPPV=pv.tran, VertPPV=pv.vert, LongPPV=pv.long,
|
||||||
PeakVectorSum=pv.peak_vector_sum)
|
PeakVectorSum=pv.peak_vector_sum)
|
||||||
|
# A waveform's peak detail (None on a histogram, so not reported).
|
||||||
|
for tag, value in (("TranTimeofPeak", pv.tran_time_of_peak),
|
||||||
|
("VertTimeofPeak", pv.vert_time_of_peak),
|
||||||
|
("LongTimeofPeak", pv.long_time_of_peak),
|
||||||
|
("MicLTimeofPeak", pv.micl_time_of_peak),
|
||||||
|
("PeakVectorSumTimeSum", pv.pvs_time),
|
||||||
|
("TranPeakAcceleration", pv.tran_peak_accel_g),
|
||||||
|
("VertPeakAcceleration", pv.vert_peak_accel_g),
|
||||||
|
("LongPeakAcceleration", pv.long_peak_accel_g),
|
||||||
|
("TranPeakDisplacement", pv.tran_peak_disp_in),
|
||||||
|
("VertPeakDisplacement", pv.vert_peak_disp_in),
|
||||||
|
("LongPeakDisplacement", pv.long_peak_disp_in)):
|
||||||
|
if value is not None:
|
||||||
|
values[tag] = value
|
||||||
|
# The unit's ZC frequency, every record type. Above range it is judged
|
||||||
|
# by its flag (_compare_scalar); below 1 Hz Blastware prints a word.
|
||||||
|
for tag, hz in (("TranZCFreq", pv.tran_zc_freq), ("VertZCFreq", pv.vert_zc_freq),
|
||||||
|
("LongZCFreq", pv.long_zc_freq), ("MicLZCFreq", pv.mic_zc_freq)):
|
||||||
|
if hz is not None:
|
||||||
|
values[tag] = "<1.0" if hz < 1.0 else hz
|
||||||
|
# Blastware's "Out of Range" line: on every DL2 event whose mic is over
|
||||||
|
# range, and on no other (18 / 18, 2026-11-09).
|
||||||
|
if pv is not None and pv.mic_over_range:
|
||||||
|
values["OORANGE"] = "Out of Range"
|
||||||
|
# The event's Monitor Log line, from the footer (2026-11-08).
|
||||||
|
if ev.monitor_log is not None:
|
||||||
|
ml = ev.monitor_log
|
||||||
|
values["MonitorLog"] = (f'{ml.start:%Y-%m-%d %H:%M:%S} - {ml.stop:%Y-%m-%d %H:%M:%S} '
|
||||||
|
f'"{ml.description}"')
|
||||||
|
# The unit's sensor check (2026-11-06), every record type.
|
||||||
|
for ch, r in (ev.sensor_check_results or {}).items():
|
||||||
|
values[f"{ch}TestResults"] = r.result
|
||||||
|
for tag, value in (("TestFreq", r.freq_hz), ("TestRatio", r.ratio),
|
||||||
|
("TestAmplitude", r.amplitude_mv)):
|
||||||
|
if value is not None:
|
||||||
|
values[f"{ch}{tag}"] = value
|
||||||
if counts["MicL"]:
|
if counts["MicL"]:
|
||||||
values["MicLPSPL dB(L)"] = mic_count_to_db(max(abs(c) for c in counts["MicL"]))
|
values["MicLPSPL dB(L)"] = mic_count_to_db(max(abs(c) for c in counts["MicL"])
|
||||||
|
/ mic_count_divisor(ev.mic_range))
|
||||||
values["MicLPSPL psi(L)"] = pv.micl if pv is not None else None
|
values["MicLPSPL psi(L)"] = pv.micl if pv is not None else None
|
||||||
|
values.update(_setup_values(ev))
|
||||||
|
if ev.stop_time is not None:
|
||||||
|
values.update(HistogramStopDate=ev.stop_time.strftime("%Y-%m-%d"),
|
||||||
|
HistogramStopTime=ev.stop_time.strftime("%H:%M:%S"))
|
||||||
|
if ev.histogram_interval_sec:
|
||||||
|
values["IntervalSize"] = _interval_size(ev.histogram_interval_sec)
|
||||||
|
interval_values: dict[str, list[object]] = {}
|
||||||
|
if ev.interval_half_periods and ev.sample_rate:
|
||||||
|
for ch, hps in ev.interval_half_periods.items():
|
||||||
|
interval_values[f"{ch} Freq Hz"] = [interval_frequency(h, ev.sample_rate) for h in hps]
|
||||||
|
if ev.interval_pvs:
|
||||||
|
# OORANGE when any geophone passes full scale in that interval: 16 / 16
|
||||||
|
# DL2 cells, and none of 2,862 without one (2026-11-09).
|
||||||
|
geo = [counts[c] for c in _GEO if counts.get(c)]
|
||||||
|
interval_values["Geo PVS in/s"] = [
|
||||||
|
"OORANGE" if any(i < len(g) and over_full_scale(g[i], "Tran") for g in geo) else v
|
||||||
|
for i, v in enumerate(ev.interval_pvs)]
|
||||||
|
times = None
|
||||||
|
n = len(counts["Tran"])
|
||||||
|
if ev.record_type == "Histogram" and ts is not None and ev.histogram_interval_sec and n:
|
||||||
|
start = datetime.datetime(ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second)
|
||||||
|
ends = interval_times(start, ev.histogram_interval_sec, ev.stop_time, n)
|
||||||
|
times = [t.strftime("%Y-%m-%d %H:%M:%S") for t in ends]
|
||||||
|
# A peak's date and time are those of the interval holding it (first).
|
||||||
|
for tag, series in (("TranPeak", counts["Tran"]), ("VertPeak", counts["Vert"]),
|
||||||
|
("LongPeak", counts["Long"]), ("MicL", counts["MicL"]),
|
||||||
|
("PeakVectorSum", ev.interval_pvs)):
|
||||||
|
if series and len(series) == n:
|
||||||
|
j = max(range(n), key=lambda q: abs(series[q]))
|
||||||
|
values[f"{tag}Date"] = ends[j].strftime("%Y-%m-%d")
|
||||||
|
values[f"{tag}Time"] = ends[j].strftime("%H:%M:%S")
|
||||||
|
|
||||||
return SfmSide(
|
return SfmSide(
|
||||||
event=ev,
|
event=ev,
|
||||||
@@ -82,6 +219,9 @@ def sfm_side(raw: bytes) -> SfmSide:
|
|||||||
channels=[ch for ch in _CHANNELS if counts[ch]],
|
channels=[ch for ch in _CHANNELS if counts[ch]],
|
||||||
counts=counts,
|
counts=counts,
|
||||||
geo_ips_per_count=_GEO_FS_BY_RANGE.get(ev.geo_range, _GEO_NORMAL_FS_INS) / _GEO_INT16_FS,
|
geo_ips_per_count=_GEO_FS_BY_RANGE.get(ev.geo_range, _GEO_NORMAL_FS_INS) / _GEO_INT16_FS,
|
||||||
|
mic_divisor=mic_count_divisor(ev.mic_range),
|
||||||
|
interval_values=interval_values,
|
||||||
|
interval_times=times,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -132,22 +272,51 @@ def _same_text(a: object, b: str) -> bool:
|
|||||||
return " ".join(str(a).split()) == " ".join(b.split())
|
return " ".join(str(a).split()) == " ".join(b.split())
|
||||||
|
|
||||||
|
|
||||||
def _mic_converter(ref: XmlReport) -> Optional[Callable[[int], float]]:
|
def _mic_table_units(ref: XmlReport) -> str:
|
||||||
units = ref.event_units or ""
|
"""The unit a report's mic sample table is printed in. Its cells say so --
|
||||||
|
a mic dB value is never under 60, psi never over 1 -- where the event's
|
||||||
|
Units line need not: S353JTHU.DT0W prints dB under psi (2026-11-09)."""
|
||||||
|
if ref.sample_rows and "MicL" in ref.channels:
|
||||||
|
i, seen = ref.channels.index("MicL"), False
|
||||||
|
for row in ref.sample_rows:
|
||||||
|
p = _printed_number(row[i]) if len(row) == len(ref.channels) else None
|
||||||
|
if p is not None:
|
||||||
|
if abs(p[0]) > 1.0:
|
||||||
|
return "dB(L)"
|
||||||
|
seen = True
|
||||||
|
if seen:
|
||||||
|
return "psi(L)"
|
||||||
|
return ref.event_units or ""
|
||||||
|
|
||||||
|
|
||||||
|
def _mic_converter(ref: XmlReport, sfm: SfmSide) -> Optional[Callable[[int], float]]:
|
||||||
|
units = _mic_table_units(ref)
|
||||||
|
d = sfm.mic_divisor
|
||||||
if "dB(L)" in units:
|
if "dB(L)" in units:
|
||||||
return mic_count_to_db
|
return lambda c: mic_count_to_db(c / d)
|
||||||
if "psi(L)" in units:
|
if "psi(L)" in units:
|
||||||
return lambda c: c * _MIC_PSI_PER_COUNT
|
return lambda c: c * _MIC_PSI_PER_COUNT / d
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
_OVER_RANGE = {"TranPPV": "tran_over_range", "VertPPV": "vert_over_range",
|
||||||
|
"LongPPV": "long_over_range", "PeakVectorSum": "pvs_over_range",
|
||||||
|
"MicLPSPL": "mic_over_range"}
|
||||||
|
|
||||||
|
|
||||||
def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> FieldResult:
|
def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> FieldResult:
|
||||||
if not printed.strip() or printed.strip() == "N/A":
|
if not printed.strip() or printed.strip() == "N/A":
|
||||||
return FieldResult(tag, "no_reference", printed, None)
|
return FieldResult(tag, "no_reference", printed, None)
|
||||||
if tag == "MicLPSPL":
|
if tag in ("MicLPSPL", "MicTriggerLevel"):
|
||||||
units = ref.event_units or ""
|
# A printed value that states its unit is compared in that unit:
|
||||||
key = ("MicLPSPL dB(L)" if "dB(L)" in units else
|
# K441LA17.IN0W's Units say psi(L), its MicTriggerLevel "125.0 dB(L)".
|
||||||
"MicLPSPL psi(L)" if "psi(L)" in units else None)
|
# Else the field's own <Units>, then the event's line: 7 DL2 reports
|
||||||
|
# print the mic peak in dB under a psi line, 3 the reverse (2026-11-09).
|
||||||
|
own = ref.units.get(tag) or ""
|
||||||
|
units = (printed if ("dB(L)" in printed or "psi(L)" in printed)
|
||||||
|
else own if ("dB(L)" in own or "psi(L)" in own) else (ref.event_units or ""))
|
||||||
|
key = (f"{tag} dB(L)" if "dB(L)" in units else
|
||||||
|
f"{tag} psi(L)" if "psi(L)" in units else None)
|
||||||
value = sfm.values.get(key) if key else None
|
value = sfm.values.get(key) if key else None
|
||||||
else:
|
else:
|
||||||
value = sfm.values.get(tag)
|
value = sfm.values.get(tag)
|
||||||
@@ -155,10 +324,17 @@ def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> Fie
|
|||||||
return FieldResult(tag, "sfm_blank", printed, None)
|
return FieldResult(tag, "sfm_blank", printed, None)
|
||||||
if printed.startswith(">"):
|
if printed.startswith(">"):
|
||||||
# ZC frequency above range: SFM agrees only by setting its flag.
|
# ZC frequency above range: SFM agrees only by setting its flag.
|
||||||
flag = getattr(sfm.event.peak_values, tag[:-len("ZCFreq")].lower() + "_zc_above_range", False)
|
ch = tag[:-len("ZCFreq")].lower()
|
||||||
|
flag = getattr(sfm.event.peak_values, ("mic" if ch == "micl" else ch) + "_zc_above_range", False)
|
||||||
return FieldResult(tag, "match" if flag else "mismatch", printed, str(value))
|
return FieldResult(tag, "match" if flag else "mismatch", printed, str(value))
|
||||||
if printed == "OORANGE":
|
# Over range: SFM agrees with Blastware's OORANGE only by setting its flag,
|
||||||
return FieldResult(tag, "mismatch", printed, str(value))
|
# and a flag against a printed number is a disagreement.
|
||||||
|
over = _OVER_RANGE.get(tag)
|
||||||
|
flagged = bool(over and getattr(sfm.event.peak_values, over, False))
|
||||||
|
if printed == "OORANGE" or flagged:
|
||||||
|
ok = printed == "OORANGE" and flagged
|
||||||
|
return FieldResult(tag, "match" if ok else "mismatch", printed,
|
||||||
|
"OORANGE" if flagged else _render(value, printed))
|
||||||
if isinstance(value, (int, float)) and not isinstance(value, bool) and _printed_number(printed):
|
if isinstance(value, (int, float)) and not isinstance(value, bool) and _printed_number(printed):
|
||||||
ok = matches_printed(float(value), printed)
|
ok = matches_printed(float(value), printed)
|
||||||
else:
|
else:
|
||||||
@@ -166,9 +342,11 @@ def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> Fie
|
|||||||
return FieldResult(tag, "match" if ok else "mismatch", printed, _render(value, printed))
|
return FieldResult(tag, "match" if ok else "mismatch", printed, _render(value, printed))
|
||||||
|
|
||||||
|
|
||||||
def _cell_diff(value: float, printed: str) -> Optional[float]:
|
def _cell_diff(value: object, printed: str) -> Optional[float]:
|
||||||
"""|value - printed| when the cell disagrees, else None; inf for a cell that
|
"""|value - printed| when the cell disagrees, else None; inf for a cell that
|
||||||
is not a number."""
|
is not a number. A word on SFM's side (">100", "N/A") must be printed."""
|
||||||
|
if isinstance(value, str):
|
||||||
|
return None if _same_text(value, printed) else float("inf")
|
||||||
p = _printed_number(printed)
|
p = _printed_number(printed)
|
||||||
if p is None:
|
if p is None:
|
||||||
return float("inf")
|
return float("inf")
|
||||||
@@ -191,7 +369,7 @@ def _series_result(field: str, n_bw: int, n_sfm: int, diffs: list[tuple[int, flo
|
|||||||
def _sample_converters(sfm: SfmSide, ref: XmlReport) -> dict[str, Callable[[int], float]]:
|
def _sample_converters(sfm: SfmSide, ref: XmlReport) -> dict[str, Callable[[int], float]]:
|
||||||
k = sfm.geo_ips_per_count
|
k = sfm.geo_ips_per_count
|
||||||
convert: dict[str, Callable[[int], float]] = {ch: (lambda c: c * k) for ch in _GEO}
|
convert: dict[str, Callable[[int], float]] = {ch: (lambda c: c * k) for ch in _GEO}
|
||||||
mic = _mic_converter(ref)
|
mic = _mic_converter(ref, sfm)
|
||||||
if mic is not None:
|
if mic is not None:
|
||||||
convert["MicL"] = mic
|
convert["MicL"] = mic
|
||||||
return convert
|
return convert
|
||||||
@@ -200,12 +378,14 @@ def _sample_converters(sfm: SfmSide, ref: XmlReport) -> dict[str, Callable[[int]
|
|||||||
def _interval_converter(title: str, sfm: SfmSide) -> Optional[Callable[[int], float]]:
|
def _interval_converter(title: str, sfm: SfmSide) -> Optional[Callable[[int], float]]:
|
||||||
"""SFM keeps each interval's peaks; it drops their frequencies and geo PVS."""
|
"""SFM keeps each interval's peaks; it drops their frequencies and geo PVS."""
|
||||||
ch, _, rest = title.partition(" ")
|
ch, _, rest = title.partition(" ")
|
||||||
|
# A peak past full scale is Blastware's OORANGE, in an interval as in the event.
|
||||||
if rest.startswith("Peak") and ch in _GEO:
|
if rest.startswith("Peak") and ch in _GEO:
|
||||||
return lambda c: c * sfm.geo_ips_per_count
|
return lambda c: "OORANGE" if over_full_scale(c, ch) else c * sfm.geo_ips_per_count
|
||||||
|
d = sfm.mic_divisor
|
||||||
if ch == "MicL" and rest == "Peak dB(L)":
|
if ch == "MicL" and rest == "Peak dB(L)":
|
||||||
return mic_count_to_db
|
return lambda c: "OORANGE" if over_full_scale(c, ch) else mic_count_to_db(c / d)
|
||||||
if ch == "MicL" and rest == "Peak psi(L)":
|
if ch == "MicL" and rest == "Peak psi(L)":
|
||||||
return lambda c: c * _MIC_PSI_PER_COUNT
|
return lambda c: "OORANGE" if over_full_scale(c, ch) else c * _MIC_PSI_PER_COUNT / d
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@@ -237,14 +417,19 @@ def series_pairs(sfm: SfmSide, ref: XmlReport,
|
|||||||
if field.startswith("intervals."):
|
if field.startswith("intervals."):
|
||||||
title = field[len("intervals."):]
|
title = field[len("intervals."):]
|
||||||
columns = ref.interval_columns or []
|
columns = ref.interval_columns or []
|
||||||
convert = _interval_converter(title, sfm)
|
if title not in columns:
|
||||||
counts = sfm.counts.get(title.partition(" ")[0], [])
|
|
||||||
if convert is None or not counts or title not in columns:
|
|
||||||
return None
|
return None
|
||||||
i = columns.index(title)
|
i = columns.index(title)
|
||||||
cells = [row[i] if i < len(row) else "" for _, row in (ref.intervals or [])]
|
cells = [row[i] if i < len(row) else "" for _, row in (ref.intervals or [])]
|
||||||
pairs = [(j, cell, convert(c)) for j, (cell, c) in enumerate(zip(cells, counts))]
|
values = sfm.interval_values.get(title)
|
||||||
return pairs, abs(len(cells) - len(counts))
|
if values is None:
|
||||||
|
convert = _interval_converter(title, sfm)
|
||||||
|
counts = sfm.counts.get(title.partition(" ")[0], [])
|
||||||
|
if convert is None or not counts:
|
||||||
|
return None
|
||||||
|
values = [convert(c) for c in counts]
|
||||||
|
pairs = [(j, cell, v) for j, (cell, v) in enumerate(zip(cells, values))]
|
||||||
|
return pairs, abs(len(cells) - len(values))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@@ -254,7 +439,9 @@ def _compare_series(field: str, n_bw: int, sfm: SfmSide, ref: XmlReport) -> Fiel
|
|||||||
return FieldResult(field, "sfm_blank", f"{n_bw} rows", None)
|
return FieldResult(field, "sfm_blank", f"{n_bw} rows", None)
|
||||||
pairs, row_len = got
|
pairs, row_len = got
|
||||||
diffs = [(j, d) for j, cell, v in pairs if (d := _cell_diff(v, cell)) is not None]
|
diffs = [(j, d) for j, cell, v in pairs if (d := _cell_diff(v, cell)) is not None]
|
||||||
n_sfm = len(sfm.counts.get(field.split(".", 1)[1].partition(" ")[0], []))
|
title = field.split(".", 1)[1]
|
||||||
|
n_sfm = (len(sfm.interval_values[title]) if title in sfm.interval_values
|
||||||
|
else len(sfm.counts.get(title.partition(" ")[0], [])))
|
||||||
return _series_result(field, n_bw, n_sfm, diffs, row_len)
|
return _series_result(field, n_bw, n_sfm, diffs, row_len)
|
||||||
|
|
||||||
|
|
||||||
@@ -265,12 +452,21 @@ def _compare_samples(sfm: SfmSide, ref: XmlReport) -> list[FieldResult]:
|
|||||||
|
|
||||||
|
|
||||||
def _compare_intervals(sfm: SfmSide, ref: XmlReport) -> list[FieldResult]:
|
def _compare_intervals(sfm: SfmSide, ref: XmlReport) -> list[FieldResult]:
|
||||||
"""One result per column, plus the interval times, which SFM does not keep."""
|
"""One result per column, plus the interval times."""
|
||||||
n = len(ref.intervals or [])
|
n = len(ref.intervals or [])
|
||||||
return ([FieldResult("intervals.Time", "sfm_blank", f"{n} rows", None)]
|
return ([_compare_interval_times(sfm, ref, n)]
|
||||||
+ [_compare_series(f"intervals.{t}", n, sfm, ref) for t in ref.interval_columns or []])
|
+ [_compare_series(f"intervals.{t}", n, sfm, ref) for t in ref.interval_columns or []])
|
||||||
|
|
||||||
|
|
||||||
|
def _compare_interval_times(sfm: SfmSide, ref: XmlReport, n: int) -> FieldResult:
|
||||||
|
if sfm.interval_times is None:
|
||||||
|
return FieldResult("intervals.Time", "sfm_blank", f"{n} rows", None)
|
||||||
|
diffs = [(j, float("inf")) for j, ((t, _), s) in enumerate(zip(ref.intervals or [], sfm.interval_times))
|
||||||
|
if not _same_text(s, t)]
|
||||||
|
return _series_result("intervals.Time", n, len(sfm.interval_times), diffs,
|
||||||
|
abs(n - len(sfm.interval_times)))
|
||||||
|
|
||||||
|
|
||||||
def compare(sfm: SfmSide, ref: XmlReport, carveouts: Sequence["Carveout"] = ()) -> list[FieldResult]:
|
def compare(sfm: SfmSide, ref: XmlReport, carveouts: Sequence["Carveout"] = ()) -> list[FieldResult]:
|
||||||
"""Every field Blastware's report carries, set against what SFM produced.
|
"""Every field Blastware's report carries, set against what SFM produced.
|
||||||
A mismatch a carve-out covers and applies to becomes `accepted`."""
|
A mismatch a carve-out covers and applies to becomes `accepted`."""
|
||||||
|
|||||||
@@ -17,7 +17,10 @@ from dataclasses import dataclass
|
|||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from .bw_xml_report import XmlReport
|
from .bw_xml_report import XmlReport
|
||||||
from .decode_check import FieldResult, SfmSide, _printed_number, series_pairs, matches_printed
|
from .decode_check import (FieldResult, SfmSide, _mic_table_units, _printed_number, series_pairs,
|
||||||
|
matches_printed)
|
||||||
|
from .event_file_io import _MIC_PSI_PER_COUNT
|
||||||
|
from .waveform_codec import mic_count_to_db
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
@@ -45,6 +48,14 @@ def _clamped(printed: str, r: float) -> bool:
|
|||||||
return p is not None and abs(p[0]) >= r - _TOL
|
return p is not None and abs(p[0]) >= r - _TOL
|
||||||
|
|
||||||
|
|
||||||
|
def _differs(v: object, cell: str) -> bool:
|
||||||
|
"""A cell SFM disagrees with. SFM's own word (its OORANGE, since
|
||||||
|
2026-11-09) agrees only when Blastware printed the same word."""
|
||||||
|
if isinstance(v, str):
|
||||||
|
return " ".join(v.split()) != " ".join(cell.split())
|
||||||
|
return not matches_printed(v, cell)
|
||||||
|
|
||||||
|
|
||||||
def _saturation(sfm: SfmSide, ref: XmlReport, res: FieldResult) -> bool:
|
def _saturation(sfm: SfmSide, ref: XmlReport, res: FieldResult) -> bool:
|
||||||
try:
|
try:
|
||||||
r = float(ref.scalars["GeoRange"])
|
r = float(ref.scalars["GeoRange"])
|
||||||
@@ -68,9 +79,23 @@ def _saturation(sfm: SfmSide, ref: XmlReport, res: FieldResult) -> bool:
|
|||||||
got = series_pairs(sfm, ref, res.field)
|
got = series_pairs(sfm, ref, res.field)
|
||||||
if got is None or got[1]:
|
if got is None or got[1]:
|
||||||
return False
|
return False
|
||||||
differing = [(cell, v) for _, cell, v in got[0] if not matches_printed(v, cell)]
|
if res.field == "intervals.Geo PVS in/s":
|
||||||
|
# Per interval, as PeakVectorSum: an OORANGE vector sum, SFM's sum within
|
||||||
|
# three channels at the ceiling, and a channel Blastware itself clamped in
|
||||||
|
# that interval. 17 / 17 DL2 cells, SFM 10.01 .. 17.33 (2026-11-03).
|
||||||
|
cols = ref.interval_columns or []
|
||||||
|
peaks = [cols.index(c) for c in ("Tran Peak in/s", "Vert Peak in/s", "Long Peak in/s")
|
||||||
|
if c in cols]
|
||||||
|
rows = ref.intervals or []
|
||||||
|
differing = [(j, cell, v) for j, cell, v in got[0] if _differs(v, cell)]
|
||||||
|
return bool(differing) and all(
|
||||||
|
cell.strip() == "OORANGE" and not isinstance(v, str)
|
||||||
|
and r - _TOL <= v <= 3 ** 0.5 * r * 1.01
|
||||||
|
and any(_clamped(rows[j][1][p], r) for p in peaks if p < len(rows[j][1]))
|
||||||
|
for j, cell, v in differing)
|
||||||
|
differing = [(cell, v) for _, cell, v in got[0] if _differs(v, cell)]
|
||||||
return bool(differing) and all(
|
return bool(differing) and all(
|
||||||
_clamped(cell, r) and _at_ceiling(v, r)
|
not isinstance(v, str) and _clamped(cell, r) and _at_ceiling(v, r)
|
||||||
and (cell.strip() == "OORANGE" or (v >= 0) == (_printed_number(cell)[0] >= 0))
|
and (cell.strip() == "OORANGE" or (v >= 0) == (_printed_number(cell)[0] >= 0))
|
||||||
for cell, v in differing)
|
for cell, v in differing)
|
||||||
|
|
||||||
@@ -79,10 +104,13 @@ SATURATION = Carveout(
|
|||||||
id="saturation",
|
id="saturation",
|
||||||
fields=("TranPPV", "VertPPV", "LongPPV", "PeakVectorSum",
|
fields=("TranPPV", "VertPPV", "LongPPV", "PeakVectorSum",
|
||||||
"samples.Tran", "samples.Vert", "samples.Long",
|
"samples.Tran", "samples.Vert", "samples.Long",
|
||||||
"intervals.Tran Peak in/s", "intervals.Vert Peak in/s", "intervals.Long Peak in/s"),
|
"intervals.Tran Peak in/s", "intervals.Vert Peak in/s", "intervals.Long Peak in/s",
|
||||||
|
"intervals.Geo PVS in/s"),
|
||||||
evidence=("Blastware clamps a clipped channel to the range maximum and prints OORANGE; "
|
evidence=("Blastware clamps a clipped channel to the range maximum and prints OORANGE; "
|
||||||
"the file holds counts past full scale (32016 counts = 10.005 in/s observed). "
|
"the file holds counts past full scale (32016 counts = 10.005 in/s observed). "
|
||||||
"scratch/verify_against_ascii.py, 2026-08-28."),
|
"scratch/verify_against_ascii.py, 2026-08-28. An interval's vector sum prints "
|
||||||
|
"OORANGE when it exceeds the range in an interval with a clamped channel: 17 / 17 "
|
||||||
|
"DL2 cells, 2026-11-03."),
|
||||||
applies=_saturation,
|
applies=_saturation,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -106,4 +134,73 @@ INTERVAL_COUNT_IS_DURATION = Carveout(
|
|||||||
applies=_interval_count_is_duration,
|
applies=_interval_count_is_duration,
|
||||||
)
|
)
|
||||||
|
|
||||||
CARVEOUTS: tuple[Carveout, ...] = (SATURATION, INTERVAL_COUNT_IS_DURATION)
|
_MIC_UNITS = ("in/s and dB(L)", "in/s and psi(L)")
|
||||||
|
|
||||||
|
|
||||||
|
def _units_is_a_display_preference(sfm: SfmSide, ref: XmlReport, res: FieldResult) -> bool:
|
||||||
|
"""Both sides say the event has a mic; they differ only in dB against psi."""
|
||||||
|
return (" ".join((res.bw or "").split()) in _MIC_UNITS
|
||||||
|
and sfm.values.get("Units") in _MIC_UNITS)
|
||||||
|
|
||||||
|
|
||||||
|
UNITS_IS_A_DISPLAY_PREFERENCE = Carveout(
|
||||||
|
id="units-is-a-display-preference",
|
||||||
|
fields=("Units",),
|
||||||
|
evidence=("dB(L) or psi(L) is Blastware's display preference on the PC when it wrote the "
|
||||||
|
"report, not the unit's: in report-write order (the _XML.XML mtimes) DL2's 70,034 "
|
||||||
|
"reports switch fleet-wide in 61 clean runs, every unit at once, and no byte or "
|
||||||
|
"bit of the event file separates the two (k-240 .. k+520, nor the 1.2 KB before "
|
||||||
|
"the footer). Instantel documents both settings: the unit's own Microphone "
|
||||||
|
"Units (MiniMate Plus manual 716U0101 Rev 15 §3.9.7: psi(L), dB(L) or Pa(L), "
|
||||||
|
"keypad Right Arrow + Setups) and Blastware's report preference (Blastware "
|
||||||
|
"manual 714U0301 Rev 22 §4, Preferences > Units and Channel: Show Mic in dB / "
|
||||||
|
"in Linear Units). 2026-11-03."),
|
||||||
|
applies=_units_is_a_display_preference,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _other_mic_unit(sfm: SfmSide, units: str):
|
||||||
|
"""SFM's mic value in the unit the report did NOT say, as Blastware renders it."""
|
||||||
|
d = sfm.mic_divisor
|
||||||
|
if "dB(L)" in units:
|
||||||
|
return lambda c: c * _MIC_PSI_PER_COUNT / d
|
||||||
|
if "psi(L)" in units:
|
||||||
|
return lambda c: mic_count_to_db(c / d)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _mic_units_mixed(sfm: SfmSide, ref: XmlReport, res: FieldResult) -> bool:
|
||||||
|
"""Every mic cell SFM disagrees with is SFM's own value in the other unit."""
|
||||||
|
counts = sfm.counts.get("MicL") or []
|
||||||
|
if res.field == "MicLPSPL":
|
||||||
|
own = ref.units.get("MicLPSPL") or ""
|
||||||
|
alt = _other_mic_unit(sfm, own if ("dB(L)" in own or "psi(L)" in own) else (ref.event_units or ""))
|
||||||
|
peak = max((abs(c) for c in counts), default=None)
|
||||||
|
return alt is not None and peak is not None and not _differs(alt(peak), res.bw or "")
|
||||||
|
got = series_pairs(sfm, ref, res.field)
|
||||||
|
# An interval column names its own unit; a sample table says it in its cells.
|
||||||
|
units = res.field if res.field.startswith("intervals.") else _mic_table_units(ref)
|
||||||
|
alt = _other_mic_unit(sfm, units)
|
||||||
|
if got is None or got[1] or alt is None:
|
||||||
|
return False
|
||||||
|
differing = [(j, cell) for j, cell, v in got[0] if _differs(v, cell)]
|
||||||
|
return bool(differing) and all(j < len(counts) and not _differs(alt(counts[j]), cell)
|
||||||
|
for j, cell in differing)
|
||||||
|
|
||||||
|
|
||||||
|
MIC_UNITS_MIXED = Carveout(
|
||||||
|
id="mic-units-mixed",
|
||||||
|
fields=("MicLPSPL", "samples.MicL", "intervals.MicL Peak psi(L)", "intervals.MicL Peak dB(L)"),
|
||||||
|
evidence=("Blastware's dB(L) / psi(L) labels do not hold for the mic on every report: 7 DL2 "
|
||||||
|
"reports print the mic peak in dB under a psi line, 3 the reverse, and some mix the "
|
||||||
|
"two inside one column -- K441L9IN.OT0W prints psi '0.000' / '-0.000' for counts of 1 "
|
||||||
|
"to 3 in a dB table, S353JTHU.DT0W psi rows then dB rows. On 19 DL2 events (14 "
|
||||||
|
"sample tables, 5 peaks) every mic cell SFM disagrees with is SFM's own value in the "
|
||||||
|
"other unit; a cell matching neither is still a mismatch. A histogram row can print "
|
||||||
|
"one unit in both its mic columns: I145HKWT.DY0H row 672 reads 95.92 under psi(L) "
|
||||||
|
"and dB(L) (count 5, dB), S353K894.OE0H rows 106 and 608 0.000 under both (count 2, "
|
||||||
|
"psi). 2026-11-09."),
|
||||||
|
applies=_mic_units_mixed,
|
||||||
|
)
|
||||||
|
|
||||||
|
CARVEOUTS: tuple[Carveout, ...] = (SATURATION, INTERVAL_COUNT_IS_DURATION,
|
||||||
|
UNITS_IS_A_DISPLAY_PREFERENCE, MIC_UNITS_MIXED)
|
||||||
+462
-35
@@ -19,18 +19,21 @@ import datetime
|
|||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import struct
|
import struct
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
from .models import Event, PeakValues, ProjectInfo, Timestamp
|
from .models import (DeviceInfo, Event, MonitorLogLine, PeakValues, ProjectInfo, SensorCheckResult,
|
||||||
|
Timestamp)
|
||||||
from . import blastware_file as _bw # avoid circular reference at module load
|
from . import blastware_file as _bw # avoid circular reference at module load
|
||||||
from .bw_ascii_report import BwAsciiReport
|
from .bw_ascii_report import BwAsciiReport
|
||||||
from . import waveform_codec as _wc
|
from . import waveform_codec as _wc
|
||||||
from .waveform_codec import decode_waveform_v2, decoded_to_adc_counts
|
from .waveform_codec import decode_waveform_v2, decoded_to_adc_counts
|
||||||
from .histogram_codec import decode_histogram_body, interval_pvs
|
from .histogram_codec import (channels_from_records, decode_histogram_body, decode_histogram_body_full,
|
||||||
|
half_period_to_hz)
|
||||||
|
|
||||||
# Reference pressure for dB(L) → psi conversion (20 µPa expressed in psi).
|
# Reference pressure for dB(L) → psi conversion (20 µPa expressed in psi).
|
||||||
# Same constant as sfm/sfm_webapp.html so server-side and browser-side
|
# Same constant as sfm/sfm_webapp.html so server-side and browser-side
|
||||||
@@ -51,7 +54,7 @@ SIDECAR_KIND = "sfm.event"
|
|||||||
# bumped without a `pip install` re-run — leading to confusing stale
|
# bumped without a `pip install` re-run — leading to confusing stale
|
||||||
# version stamps in sidecars. Bump this constant and CHANGELOG.md
|
# version stamps in sidecars. Bump this constant and CHANGELOG.md
|
||||||
# together at release time.
|
# together at release time.
|
||||||
TOOL_VERSION = "0.33.0" # setup + notes, record type, histogram PVS and mic from the file; gates the backfill regen
|
TOOL_VERSION = "0.35.0" # file-only decode groups D2, E, F, over range, mic range; gates the backfill regen
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Best-effort: prefer the installed metadata when it's NEWER than the
|
# Best-effort: prefer the installed metadata when it's NEWER than the
|
||||||
@@ -716,6 +719,15 @@ _HIST_GEO_COUNTS_PER_UNIT = 16
|
|||||||
# 0.0125 / 32768, that read every mic peak ~95x low (2026-10-31).
|
# 0.0125 / 32768, that read every mic peak ~95x low (2026-10-31).
|
||||||
_PA_PER_PSI = 6894.757
|
_PA_PER_PSI = 6894.757
|
||||||
_MIC_PSI_PER_COUNT = _wc.MIC_PA_PER_COUNT / _PA_PER_PSI
|
_MIC_PSI_PER_COUNT = _wc.MIC_PA_PER_COUNT / _PA_PER_PSI
|
||||||
|
# The mic's own range byte (its channel block, label + 29, as the geophones'):
|
||||||
|
# at 1 each count is an eighth. Set on 7 DL2 events, all of them Blastware's
|
||||||
|
# values divided by 8, and on none of the other 70,026 (2026-11-09).
|
||||||
|
_MIC_COUNTS_PER_UNIT_BY_RANGE = {0: 1, 1: 8}
|
||||||
|
|
||||||
|
|
||||||
|
def mic_count_divisor(mic_range: Optional[int]) -> int:
|
||||||
|
"""How many of a mic's counts make one 0.25 Pa unit at its range."""
|
||||||
|
return _MIC_COUNTS_PER_UNIT_BY_RANGE.get(mic_range, 1)
|
||||||
|
|
||||||
|
|
||||||
def _decode_strt(strt: bytes) -> dict:
|
def _decode_strt(strt: bytes) -> dict:
|
||||||
@@ -752,7 +764,8 @@ def _decode_samples_4ch_int16_le(stream: bytes) -> dict[str, list[int]]:
|
|||||||
|
|
||||||
|
|
||||||
def _peaks_from_samples(samples: dict[str, list[int]],
|
def _peaks_from_samples(samples: dict[str, list[int]],
|
||||||
geo_fs_ins: float = _GEO_NORMAL_FS_INS) -> PeakValues:
|
geo_fs_ins: float = _GEO_NORMAL_FS_INS,
|
||||||
|
mic_divisor: int = 1) -> PeakValues:
|
||||||
"""
|
"""
|
||||||
Compute peaks from raw int16 samples at the given geophone full scale
|
Compute peaks from raw int16 samples at the given geophone full scale
|
||||||
(Normal, 10 in/s, unless the file's range says otherwise). Used by the
|
(Normal, 10 in/s, unless the file's range says otherwise). Used by the
|
||||||
@@ -769,9 +782,9 @@ def _peaks_from_samples(samples: dict[str, list[int]],
|
|||||||
vert = _peak_ins(samples.get("Vert", []))
|
vert = _peak_ins(samples.get("Vert", []))
|
||||||
long_ = _peak_ins(samples.get("Long", []))
|
long_ = _peak_ins(samples.get("Long", []))
|
||||||
|
|
||||||
# Mic in psi: one count = 0.25 Pa
|
# Mic in psi: one count = 0.25 Pa, an eighth of that on a range-1 mic
|
||||||
mic_ch = samples.get("MicL", []) or []
|
mic_ch = samples.get("MicL", []) or []
|
||||||
mic = max((abs(int(v)) for v in mic_ch), default=0) * _MIC_PSI_PER_COUNT
|
mic = max((abs(int(v)) for v in mic_ch), default=0) * _MIC_PSI_PER_COUNT / mic_divisor
|
||||||
|
|
||||||
# Peak vector sum: max over time of sqrt(T^2 + V^2 + L^2)
|
# Peak vector sum: max over time of sqrt(T^2 + V^2 + L^2)
|
||||||
pvs = 0.0
|
pvs = 0.0
|
||||||
@@ -793,6 +806,92 @@ def _peaks_from_samples(samples: dict[str, list[int]],
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Blastware's g for peak acceleration, fitted: every printed acceleration in
|
||||||
|
# DL2 bounds it, and together they leave [386.2236, 386.2240] in/s^2 -- 19,475 /
|
||||||
|
# 19,479 values fit (the other 4: one odd file, O117I1NK.R70W, and one sample
|
||||||
|
# mismatch). That is 9.81 m/s^2 (386.2205) plus an offset not explained, as
|
||||||
|
# with the mic's fitted dB offset; 9.81 gives 19,423, the standard 9.80665 gives
|
||||||
|
# 17,806 (2026-11-04).
|
||||||
|
_ACCEL_IPS2_PER_G = 386.2238
|
||||||
|
|
||||||
|
|
||||||
|
def _waveform_peak_detail(pv: PeakValues, samples: dict[str, list[int]], geo_fs_ins: float,
|
||||||
|
sample_rate: int, pretrig: int) -> None:
|
||||||
|
"""A waveform's time of peak per channel, the vector sum's time and each
|
||||||
|
geophone's peak acceleration, on `pv`. Measured on 400 DL2 waveforms
|
||||||
|
(2026-11-04):
|
||||||
|
* time of peak = (first peak sample - pre-trigger samples) / sample rate,
|
||||||
|
1,197 / 1,197; the vector-sum time is the same on sqrt(T^2 + V^2 + L^2),
|
||||||
|
398 / 399
|
||||||
|
* peak acceleration = the largest |v[i+1] - v[i]| x sample rate / g,
|
||||||
|
with Blastware's fitted g -- the manuals: "subtracts two velocity
|
||||||
|
readings and divides the result by the elapsed time between them"."""
|
||||||
|
scale = geo_fs_ins / _GEO_INT16_FS
|
||||||
|
geo = {}
|
||||||
|
for ch in ("Tran", "Vert", "Long", "MicL"):
|
||||||
|
c = samples.get(ch) or []
|
||||||
|
if not c:
|
||||||
|
continue
|
||||||
|
i = max(range(len(c)), key=lambda k: abs(c[k]))
|
||||||
|
setattr(pv, f"{ch.lower()}_time_of_peak", (i - pretrig) / sample_rate)
|
||||||
|
if ch != "MicL":
|
||||||
|
geo[ch] = c
|
||||||
|
step = max((abs(c[k + 1] - c[k]) for k in range(len(c) - 1)), default=0)
|
||||||
|
setattr(pv, f"{ch.lower()}_peak_accel_g", step * scale * sample_rate / _ACCEL_IPS2_PER_G)
|
||||||
|
if len(geo) == 3:
|
||||||
|
n = min(len(c) for c in geo.values())
|
||||||
|
t, v, l = geo["Tran"], geo["Vert"], geo["Long"]
|
||||||
|
j = max(range(n), key=lambda k: t[k] * t[k] + v[k] * v[k] + l[k] * l[k])
|
||||||
|
pv.pvs_time = (j - pretrig) / sample_rate
|
||||||
|
|
||||||
|
|
||||||
|
def _zc_from_half_period(halfp: int, sample_rate: int) -> tuple[Optional[float], bool]:
|
||||||
|
"""(ZC frequency, above range) as Blastware reports it: None for a
|
||||||
|
half-period of 0 ("N/A"); Blastware's threshold, flagged, at 5 samples or
|
||||||
|
fewer (">100", ">200" at 2048 sps); else (rate / 2) / half-period, which
|
||||||
|
Blastware prints as "<1.0" below 1 Hz."""
|
||||||
|
if halfp == 0:
|
||||||
|
return None, False
|
||||||
|
hz = half_period_to_hz(halfp, sample_rate)
|
||||||
|
if hz is None:
|
||||||
|
return 100.0 * sample_rate / 1024, True
|
||||||
|
return hz, False
|
||||||
|
|
||||||
|
|
||||||
|
def _apply_unit_summary(pv: PeakValues, summary: dict, geo_fs_ins: float, sample_rate: int,
|
||||||
|
pretrig: Optional[int]) -> None:
|
||||||
|
"""The unit's own values from its event summary, on `pv`. Blastware prints
|
||||||
|
them as they are (DL2, 2026-11-05):
|
||||||
|
* ZC frequency, every record type: 15,844 / 15,844 waveform and
|
||||||
|
104,000 / 104,000 histogram values, and every word
|
||||||
|
* a waveform's peak displacement = half its integral: 19,479 / 19,479
|
||||||
|
* a waveform's times of peak and vector-sum time, from the unit's peak
|
||||||
|
samples (`pretrig` given): they replace the samples' own, which differ
|
||||||
|
only where the stored samples wrap (O117I1NK.R70W)
|
||||||
|
* over range, every record type: a channel whose peak passes full scale,
|
||||||
|
and the vector sum when any geophone does -- Blastware's OORANGE on all
|
||||||
|
43 such events, and on none of the 38 whose vector sum alone passes
|
||||||
|
the range (2026-11-09)."""
|
||||||
|
# The summary's geophone values are decoder units, as a histogram's are.
|
||||||
|
unit_ins = _HIST_GEO_COUNTS_PER_UNIT * geo_fs_ins / _GEO_INT16_FS
|
||||||
|
for ch, attr in (("Tran", "tran"), ("Vert", "vert"), ("Long", "long"), ("MicL", "mic")):
|
||||||
|
c = summary.get(ch)
|
||||||
|
if c is None:
|
||||||
|
continue
|
||||||
|
hz, above = _zc_from_half_period(c["half_period"], sample_rate)
|
||||||
|
setattr(pv, f"{attr}_zc_freq", hz)
|
||||||
|
setattr(pv, f"{attr}_zc_above_range", above)
|
||||||
|
setattr(pv, f"{attr}_over_range", max(abs(c["min"]), abs(c["max"])) > _SUMMARY_FULL_SCALE)
|
||||||
|
if pretrig is None:
|
||||||
|
continue
|
||||||
|
setattr(pv, f"{ch.lower()}_time_of_peak", (c["peak_sample"] - pretrig) / sample_rate)
|
||||||
|
if ch != "MicL":
|
||||||
|
setattr(pv, f"{attr}_peak_disp_in", c["disp_integral"] * unit_ins / sample_rate / 2)
|
||||||
|
pv.pvs_over_range = pv.tran_over_range or pv.vert_over_range or pv.long_over_range
|
||||||
|
if pretrig is not None and all(ch in summary for ch in ("Tran", "Vert", "Long")):
|
||||||
|
pv.pvs_time = (summary["pvs_sample"] - pretrig) / sample_rate
|
||||||
|
|
||||||
|
|
||||||
# STRT[18], the record-type byte (#41): 0x46 on every one of DL2's 6,577
|
# STRT[18], the record-type byte (#41): 0x46 on every one of DL2's 6,577
|
||||||
# waveform files and 0x0A on every one of its 63,535 histograms (measured
|
# waveform files and 0x0A on every one of its 63,535 histograms (measured
|
||||||
# 2026-10-29). Manual / Event / Combo never occur there, so their bytes are
|
# 2026-10-29). Manual / Event / Combo never occur there, so their bytes are
|
||||||
@@ -862,6 +961,7 @@ _RECTIME_OFFSET_BEFORE_MARKER = 30
|
|||||||
# 2026-10-29). Offsets are from the first byte of the name.
|
# 2026-10-29). Offsets are from the first byte of the name.
|
||||||
_SETUP_NAME_RE = re.compile(rb"\x1c\x08([\x20-\x7e]{1,40})\x00")
|
_SETUP_NAME_RE = re.compile(rb"\x1c\x08([\x20-\x7e]{1,40})\x00")
|
||||||
_SAMPLE_RATE_BEFORE_NAME = 42 # uint16 BE, samples per second
|
_SAMPLE_RATE_BEFORE_NAME = 42 # uint16 BE, samples per second
|
||||||
|
_INTERVAL_BEFORE_NAME = 40 # uint16 BE, histogram interval in seconds (2 / 5 / 15 / 60 / 300)
|
||||||
_PRETRIG_BEFORE_NAME = 36 # float32 BE, seconds, negative (-0.25, -0.0625 ...)
|
_PRETRIG_BEFORE_NAME = 36 # float32 BE, seconds, negative (-0.25, -0.0625 ...)
|
||||||
_RECTIME_BEFORE_NAME = 30 # float32 BE, seconds (the marker's offset above)
|
_RECTIME_BEFORE_NAME = 30 # float32 BE, seconds (the marker's offset above)
|
||||||
_SAMPLE_RATES = (1024, 2048, 4096)
|
_SAMPLE_RATES = (1024, 2048, 4096)
|
||||||
@@ -895,17 +995,23 @@ def _ts8(b: bytes) -> Optional[datetime.datetime]:
|
|||||||
def _embedded_event_record(
|
def _embedded_event_record(
|
||||||
raw: bytes, end: int, start: Optional[datetime.datetime],
|
raw: bytes, end: int, start: Optional[datetime.datetime],
|
||||||
stop: Optional[datetime.datetime], record_time: Optional[float],
|
stop: Optional[datetime.datetime], record_time: Optional[float],
|
||||||
) -> tuple[Optional[datetime.datetime], str]:
|
) -> tuple[Optional[datetime.datetime], str, Optional[int], Optional[int]]:
|
||||||
"""The trigger time from the instrument's embedded event record, or (None, why).
|
"""The trigger time, the trigger source and the offset of the record's
|
||||||
|
`fe 80` from the instrument's embedded event record, or (None, why, None,
|
||||||
|
None).
|
||||||
|
|
||||||
Every `fe 80` before `end` (the footer) is a candidate. One counts only if
|
Every `fe 80` before `end` (the footer) is a candidate. One counts only if
|
||||||
its lead bytes match, both its times are well formed, the footer's session
|
its lead bytes match, both its times are well formed, the footer's session
|
||||||
start <= trigger <= its stop, its stop is the footer's stop or a second
|
start <= trigger <= its stop, its stop is the footer's stop or a second
|
||||||
before it, and its length agrees with the record time. Exactly one may
|
before it, and its length agrees with the record time. Exactly one may
|
||||||
pass: none, or more than one, is reported rather than guessed between.
|
pass: none, or more than one, is reported rather than guessed between.
|
||||||
|
|
||||||
|
The two bytes between the lead and `fe 80` are the trigger source, a uint16
|
||||||
|
BE bitmask: 0x01 Tran, 0x02 Vert, 0x04 Long, 0x08 MicL, 0x200 Manual --
|
||||||
|
Blastware's Trigger on 6,493 / 6,493 DL2 waveforms (2026-11-03).
|
||||||
"""
|
"""
|
||||||
if start is None or stop is None:
|
if start is None or stop is None:
|
||||||
return None, "the footer has no start and stop to check one against"
|
return None, "the footer has no start and stop to check one against", None, None
|
||||||
found, rejected = [], 0
|
found, rejected = [], 0
|
||||||
i = raw.find(_EVENT_RECORD_MARKER, 6)
|
i = raw.find(_EVENT_RECORD_MARKER, 6)
|
||||||
while 0 <= i and i + 18 <= end:
|
while 0 <= i and i + 18 <= end:
|
||||||
@@ -921,15 +1027,203 @@ def _embedded_event_record(
|
|||||||
<= _EVENT_RECORD_SLACK_S[1])
|
<= _EVENT_RECORD_SLACK_S[1])
|
||||||
)
|
)
|
||||||
if valid:
|
if valid:
|
||||||
found.append(trig)
|
found.append((trig, int.from_bytes(raw[i - 2:i], "big"), i))
|
||||||
else:
|
else:
|
||||||
rejected += 1
|
rejected += 1
|
||||||
i = raw.find(_EVENT_RECORD_MARKER, i + 1)
|
i = raw.find(_EVENT_RECORD_MARKER, i + 1)
|
||||||
if len(found) == 1:
|
if len(found) == 1:
|
||||||
return found[0], ""
|
return found[0][0], "", found[0][1], found[0][2]
|
||||||
if found:
|
if found:
|
||||||
return None, f"{len(found)} candidates validate"
|
return None, f"{len(found)} candidates validate", None, None
|
||||||
return None, (f"{rejected} candidate(s), none valid" if rejected else "no candidate")
|
return None, (f"{rejected} candidate(s), none valid" if rejected else "no candidate"), None, None
|
||||||
|
|
||||||
|
|
||||||
|
# A histogram's event record: the same lead, the source 0x0400, marker fe f5,
|
||||||
|
# then its start and stop -- Blastware's Histogram Start / Stop on 63,490 /
|
||||||
|
# 63,490 DL2 histograms. On all 63,500 its start is 0 or 1 s after the footer's
|
||||||
|
# start and its stop 0 or 1 s before the footer's stop (2026-11-03).
|
||||||
|
_HISTOGRAM_RECORD_MARKER = b"\xfe\xf5"
|
||||||
|
_HISTOGRAM_RECORD_SOURCE = b"\x04\x00"
|
||||||
|
|
||||||
|
|
||||||
|
def interval_times(start: datetime.datetime, interval_sec: int,
|
||||||
|
stop: Optional[datetime.datetime], n: int) -> list[datetime.datetime]:
|
||||||
|
"""Each histogram interval's time as Blastware prints it: the interval's
|
||||||
|
end, start + (i + 1) x interval, capped at the stop. 2,308,524 / 2,308,524
|
||||||
|
DL2 rows; and an event's peak date and time are its interval's (2026-11-03)."""
|
||||||
|
out = []
|
||||||
|
for i in range(n):
|
||||||
|
t = start + datetime.timedelta(seconds=interval_sec * (i + 1))
|
||||||
|
out.append(min(t, stop) if stop is not None else t)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def _histogram_event_record(
|
||||||
|
raw: bytes, end: int, start: Optional[datetime.datetime],
|
||||||
|
stop: Optional[datetime.datetime],
|
||||||
|
) -> tuple[Optional[datetime.datetime], Optional[datetime.datetime], str, Optional[int]]:
|
||||||
|
"""(start, stop, "", offset of its `fe f5`) from a histogram's own event
|
||||||
|
record, or (None, None, why, None). Exactly one record may validate against
|
||||||
|
the footer's start and stop."""
|
||||||
|
if start is None or stop is None:
|
||||||
|
return None, None, "the footer has no start and stop to check one against", None
|
||||||
|
found, rejected = [], 0
|
||||||
|
i = raw.find(_HISTOGRAM_RECORD_MARKER, 6)
|
||||||
|
while 0 <= i and i + 18 <= end:
|
||||||
|
a, b = _ts8(raw[i + 2:i + 10]), _ts8(raw[i + 10:i + 18])
|
||||||
|
if (raw[i - 6:i - 2] == _EVENT_RECORD_LEAD and raw[i - 2:i] == _HISTOGRAM_RECORD_SOURCE
|
||||||
|
and a is not None and b is not None and a <= b
|
||||||
|
and 0 <= (a - start).total_seconds() <= 1
|
||||||
|
and 0 <= (stop - b).total_seconds() <= 1):
|
||||||
|
found.append((a, b, i))
|
||||||
|
elif raw[i - 6:i - 2] == _EVENT_RECORD_LEAD:
|
||||||
|
rejected += 1
|
||||||
|
i = raw.find(_HISTOGRAM_RECORD_MARKER, i + 1)
|
||||||
|
if len(found) == 1:
|
||||||
|
return found[0][0], found[0][1], "", found[0][2]
|
||||||
|
if found:
|
||||||
|
return None, None, f"{len(found)} candidates validate", None
|
||||||
|
return None, None, (f"{rejected} candidate(s), none valid" if rejected else "no candidate"), None
|
||||||
|
|
||||||
|
|
||||||
|
# The event record is the first of a chain of [length uint16 BE][id][payload]
|
||||||
|
# records, the next starting `length` + 2 bytes after a record's lead (measured
|
||||||
|
# on all 70,041 DL2 files, 2026-11-06): the event record 0x05, the unit's
|
||||||
|
# summary 0x32-0x35, its sensor checks 0x3c-0x3f, then the footer 0x0e -- the
|
||||||
|
# file's last 26 bytes. A unit without a mic has no 0x35 or 0x3f (8 files).
|
||||||
|
# The walk ends exactly at the file's end on every one, so a chain that does
|
||||||
|
# not is not read at all.
|
||||||
|
_RECORD_LEAD_TO_MARKER = 6 # the lead `00 28 05 00` and the source sit before the marker
|
||||||
|
|
||||||
|
|
||||||
|
def _record_chain(raw: bytes, marker_at: int) -> Optional[dict[int, bytes]]:
|
||||||
|
"""Each record's payload by id (the first of each), for the chain that
|
||||||
|
starts with the validated event record whose marker is at `marker_at`; None
|
||||||
|
unless the chain ends exactly at the end of the file."""
|
||||||
|
off = marker_at - _RECORD_LEAD_TO_MARKER
|
||||||
|
out: dict[int, bytes] = {}
|
||||||
|
while off < len(raw):
|
||||||
|
ln = int.from_bytes(raw[off:off + 2], "big")
|
||||||
|
if off + 3 > len(raw) or ln < 1 or off + 2 + ln > len(raw):
|
||||||
|
return None
|
||||||
|
out.setdefault(raw[off + 2], raw[off + 3:off + 2 + ln])
|
||||||
|
off += 2 + ln
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
# The unit's own event summary (measured on DL2, 2026-11-05). The event
|
||||||
|
# record's payload holds the vector-sum peak's sample at [25:29] (its marker
|
||||||
|
# + 22). Then one record per channel, 22 bytes (ids 0x32 Tran .. 0x35 MicL):
|
||||||
|
# [0] 0 [1:3] min [3:5] max (int16 BE; geophones in units of 16 counts)
|
||||||
|
# [5:9] peak sample [9:11] half-period, samples [11:15] displacement
|
||||||
|
# integral, units x samples [15:21] probably the unit's own largest sample step
|
||||||
|
# x 65,536 (inferred), which Blastware does not print: its acceleration is its own
|
||||||
|
# computation from the samples (_waveform_peak_detail)
|
||||||
|
# min, max and peak sample equal the samples' own on 25,962 / 25,966 DL2
|
||||||
|
# channels (the 4 others: O117I1NK.R70W, whose samples wrap at the trigger).
|
||||||
|
_EVENT_RECORD_ID = 0x05
|
||||||
|
_SUMMARY_PVS_SAMPLE = slice(25, 29)
|
||||||
|
_SUMMARY_CHANNELS = {0x32: "Tran", 0x33: "Vert", 0x34: "Long", 0x35: "MicL"}
|
||||||
|
_SUMMARY_CHANNEL_LEN = 21 # the payload; the record is 22 with its id
|
||||||
|
# Full scale in the summary's units: 2,000 x 16 = 32,000 counts on either
|
||||||
|
# geophone range, and 2,000 counts on the mic. A peak past it is Blastware's
|
||||||
|
# OORANGE: numeric up to 1,991 / 1,933, OORANGE from 2,001 (DL2, 2026-11-09).
|
||||||
|
_SUMMARY_FULL_SCALE = 2000
|
||||||
|
|
||||||
|
|
||||||
|
def over_full_scale(count: int, channel: str) -> bool:
|
||||||
|
"""Whether a decoded peak passes full scale: Blastware's OORANGE. A geophone
|
||||||
|
count is in ADC counts (16 to the unit), the mic's in its own. The same rule
|
||||||
|
holds inside a histogram's intervals: numeric up to 1,846 / 1,414, OORANGE
|
||||||
|
from 2,001 (DL2, 2026-11-09)."""
|
||||||
|
per_unit = 1 if channel == "MicL" else _HIST_GEO_COUNTS_PER_UNIT
|
||||||
|
return abs(count) > _SUMMARY_FULL_SCALE * per_unit
|
||||||
|
|
||||||
|
|
||||||
|
def _unit_summary(chain: dict[int, bytes]) -> Optional[dict]:
|
||||||
|
"""The unit's per-channel event summary from a record chain:
|
||||||
|
{"pvs_sample": int, "Tran": {...}, ...}, each channel {"min", "max",
|
||||||
|
"peak_sample", "half_period", "disp_integral"}. None when the chain has no
|
||||||
|
channel record."""
|
||||||
|
out: dict = {"pvs_sample": int.from_bytes(chain.get(_EVENT_RECORD_ID, b"")[_SUMMARY_PVS_SAMPLE], "big")}
|
||||||
|
for rid, ch in _SUMMARY_CHANNELS.items():
|
||||||
|
p = chain.get(rid)
|
||||||
|
if p is None or len(p) != _SUMMARY_CHANNEL_LEN:
|
||||||
|
continue
|
||||||
|
out[ch] = {
|
||||||
|
"min": struct.unpack(">h", p[1:3])[0],
|
||||||
|
"max": struct.unpack(">h", p[3:5])[0],
|
||||||
|
"peak_sample": int.from_bytes(p[5:9], "big"),
|
||||||
|
"half_period": int.from_bytes(p[9:11], "big"),
|
||||||
|
"disp_integral": int.from_bytes(p[11:15], "big"),
|
||||||
|
}
|
||||||
|
return out if len(out) > 1 else None
|
||||||
|
|
||||||
|
|
||||||
|
# The sensor check's results, in the header of each sensor-check record (ids
|
||||||
|
# 0x3c Tran .. 0x3f MicL, whose traces minimateplus.sensor_check decodes).
|
||||||
|
# Payload: [2] channel type (1 geophone, 2 mic, 0 the check disabled) [4] status,
|
||||||
|
# 0 = passed [5:7] frequency x 10 [7:9] ratio x 10 [9:11] amplitude, mV.
|
||||||
|
# Blastware prints them as they are (DL2, 2026-11-06): 209,943 / 209,943
|
||||||
|
# geophone frequencies and ratios, 69,975 / 69,975 mic frequencies and
|
||||||
|
# amplitudes; "Passed" on status 0 and "Check" on every other (1 .. 15: its bits
|
||||||
|
# are not decoded), "Disabled", with nothing else, on type 0.
|
||||||
|
_SENSOR_CHECK_CHANNELS = {0x3c: "Tran", 0x3d: "Vert", 0x3e: "Long", 0x3f: "MicL"}
|
||||||
|
_SENSOR_CHECK_HEADER_LEN = 11
|
||||||
|
|
||||||
|
|
||||||
|
def _sensor_check_results(chain: dict[int, bytes]) -> Optional[dict[str, SensorCheckResult]]:
|
||||||
|
out: dict[str, SensorCheckResult] = {}
|
||||||
|
for rid, ch in _SENSOR_CHECK_CHANNELS.items():
|
||||||
|
p = chain.get(rid)
|
||||||
|
if p is None or len(p) < _SENSOR_CHECK_HEADER_LEN:
|
||||||
|
continue
|
||||||
|
kind, status = p[2], p[4]
|
||||||
|
if kind == 0:
|
||||||
|
out[ch] = SensorCheckResult("Disabled", status)
|
||||||
|
continue
|
||||||
|
r = SensorCheckResult("Passed" if status == 0 else "Check", status,
|
||||||
|
freq_hz=int.from_bytes(p[5:7], "big") / 10)
|
||||||
|
if ch == "MicL":
|
||||||
|
r.amplitude_mv = int.from_bytes(p[9:11], "big")
|
||||||
|
else:
|
||||||
|
r.ratio = int.from_bytes(p[7:9], "big") / 10
|
||||||
|
out[ch] = r
|
||||||
|
return out or None
|
||||||
|
|
||||||
|
|
||||||
|
# The Monitor Log line Blastware prints for an event is the footer's start and
|
||||||
|
# stop, then words for the footer's flag word [18:20]: 69,983 / 69,983 DL2
|
||||||
|
# lines, character for character (2026-11-08). Every DL2 line has "Event
|
||||||
|
# Recorded"; a session that ended adds how. One line sets Modem and Timer and
|
||||||
|
# prints Modem, so the higher bit wins -- the order of the others is inferred.
|
||||||
|
_MONITOR_LOG_RECORDED = 0x0001
|
||||||
|
_MONITOR_LOG_ENDS = { # highest bit first
|
||||||
|
0x0800: "Memory Full Exit",
|
||||||
|
0x0200: "Battery Low Exit",
|
||||||
|
0x0020: "Modem Exit",
|
||||||
|
0x0010: "Timer Stop",
|
||||||
|
0x0008: "Selfcheck Passed",
|
||||||
|
0x0004: "Remote Exit",
|
||||||
|
0x0002: "Keyboard Exit",
|
||||||
|
}
|
||||||
|
_FOOTER_ID = 0x0E
|
||||||
|
_FOOTER_LEN = 26
|
||||||
|
|
||||||
|
|
||||||
|
def monitor_log_description(flags: int) -> str:
|
||||||
|
"""Blastware's Monitor Log words for a footer flag word."""
|
||||||
|
words = "Event Recorded " if flags & _MONITOR_LOG_RECORDED else ""
|
||||||
|
end = next((w for bit, w in _MONITOR_LOG_ENDS.items() if flags & bit), None)
|
||||||
|
return words + (" " + end if end else "")
|
||||||
|
|
||||||
|
|
||||||
|
def _monitor_log(footer: bytes) -> Optional[MonitorLogLine]:
|
||||||
|
start, stop = _bw._decode_ts_be(footer[2:10]), _bw._decode_ts_be(footer[10:18])
|
||||||
|
if start is None or stop is None:
|
||||||
|
return None
|
||||||
|
flags = int.from_bytes(footer[18:20], "big")
|
||||||
|
return MonitorLogLine(start, stop, flags, monitor_log_description(flags))
|
||||||
|
|
||||||
|
|
||||||
def _parse_record_time_seconds(raw: bytes) -> Optional[float]:
|
def _parse_record_time_seconds(raw: bytes) -> Optional[float]:
|
||||||
@@ -1047,6 +1341,84 @@ def _setup_geo_range(raw: bytes) -> tuple[Optional[int], Optional[str]]:
|
|||||||
return None, f"geophone range not read: channel range bytes {found}"
|
return None, f"geophone range not read: channel range bytes {found}"
|
||||||
|
|
||||||
|
|
||||||
|
# The identity block before the setup: what the live read gets from SUB FE
|
||||||
|
# (DeviceInfo). Offsets back from k, the setup name; matched against every DL2
|
||||||
|
# report 2026-11-03 -- serial, version and calibration 69,983 / 69,983, the
|
||||||
|
# battery 69,729 plus 254 that Blastware rounds half up (6.25 -> "6.3 Volts").
|
||||||
|
_SERIAL_BEFORE_NAME = 202 # ASCII, NUL-terminated
|
||||||
|
_BATTERY_BEFORE_NAME = 190 # uint16 BE, hundredths of a volt
|
||||||
|
_FIRMWARE_MINOR_BEFORE_NAME = 193 # 0x11 = 17 for S338.17, as SUB EA
|
||||||
|
_FIRMWARE_BEFORE_NAME = 147 # "S338.17"
|
||||||
|
_DSP_BEFORE_NAME = 138 # "10.72"
|
||||||
|
_CALIBRATION_BEFORE_NAME = 132 # dd mm yyyy (BE)
|
||||||
|
_CALIBRATED_BY_BEFORE_NAME = 128 # "Instantel"
|
||||||
|
_MANUFACTURER_BEFORE_NAME = 94 # "Instantel"
|
||||||
|
_MODEL_BEFORE_NAME = 72 # "MiniMate Plus" / "BlastMate III"
|
||||||
|
|
||||||
|
|
||||||
|
def _cstr(raw: bytes, i: int, limit: int = 40) -> Optional[str]:
|
||||||
|
if i < 0:
|
||||||
|
return None
|
||||||
|
j = raw.find(b"\x00", i, i + limit)
|
||||||
|
s = raw[i:j if j >= 0 else i + limit].decode("ascii", errors="replace").strip()
|
||||||
|
return s or None
|
||||||
|
|
||||||
|
|
||||||
|
def _setup_identity(raw: bytes, k: int) -> tuple[Optional[DeviceInfo], Optional[float]]:
|
||||||
|
"""(the unit's identity, the battery in volts) from the block before the
|
||||||
|
setup name at k."""
|
||||||
|
if k < _SERIAL_BEFORE_NAME:
|
||||||
|
return None, None
|
||||||
|
serial = _cstr(raw, k - _SERIAL_BEFORE_NAME, 16)
|
||||||
|
if not serial:
|
||||||
|
return None, None
|
||||||
|
c = k - _CALIBRATION_BEFORE_NAME
|
||||||
|
try:
|
||||||
|
cal = datetime.date(int.from_bytes(raw[c + 2:c + 4], "big"), raw[c + 1], raw[c])
|
||||||
|
except ValueError:
|
||||||
|
cal = None
|
||||||
|
info = DeviceInfo(
|
||||||
|
serial=serial,
|
||||||
|
firmware_minor=raw[k - _FIRMWARE_MINOR_BEFORE_NAME],
|
||||||
|
firmware_version=_cstr(raw, k - _FIRMWARE_BEFORE_NAME, 9),
|
||||||
|
dsp_version=_cstr(raw, k - _DSP_BEFORE_NAME, 6),
|
||||||
|
manufacturer=_cstr(raw, k - _MANUFACTURER_BEFORE_NAME),
|
||||||
|
model=_cstr(raw, k - _MODEL_BEFORE_NAME),
|
||||||
|
calibration_date=cal,
|
||||||
|
calibrated_by=_cstr(raw, k - _CALIBRATED_BY_BEFORE_NAME, 32),
|
||||||
|
)
|
||||||
|
b = k - _BATTERY_BEFORE_NAME
|
||||||
|
return info, int.from_bytes(raw[b:b + 2], "big") / 100
|
||||||
|
|
||||||
|
|
||||||
|
# Trigger settings, in Series IV's 0x1A layout again: the trigger-source bitmask
|
||||||
|
# at k - 19 ([29]: 0x07 geophones, 0x08 mic), the stop mode at k - 31 ([17],
|
||||||
|
# 0 = Fixed), and each channel block's trigger level, a float32 at label + 30 --
|
||||||
|
# in/s for a geophone, psi for the mic. The mic block's type code at label + 4
|
||||||
|
# is Series IV's (2 = linear). Against every DL2 waveform (2026-11-03): the geo
|
||||||
|
# level 6,447 / 6,447, the mic level 4,403 / 4,403, and Blastware prints a level
|
||||||
|
# exactly when its channel is a trigger source and the event was not Manual.
|
||||||
|
_TRIGGER_SOURCES_BEFORE_NAME = 19
|
||||||
|
_STOP_MODE_BEFORE_NAME = 31
|
||||||
|
_TRIGGER_LEVEL_AFTER_LABEL = 30
|
||||||
|
_MIC_TYPE_AFTER_LABEL = 4
|
||||||
|
|
||||||
|
|
||||||
|
def _setup_trigger(raw: bytes, k: int) -> dict:
|
||||||
|
out = {"trigger_sources": raw[k - _TRIGGER_SOURCES_BEFORE_NAME],
|
||||||
|
"record_stop_mode": raw[k - _STOP_MODE_BEFORE_NAME]}
|
||||||
|
t = raw.find(b"\x00\x00\x01Tran", k, k + _CHANNEL_BLOCK_SPAN)
|
||||||
|
if t >= 0:
|
||||||
|
p = t + 3 + _TRIGGER_LEVEL_AFTER_LABEL
|
||||||
|
out["trigger_level_geo"] = struct.unpack_from(">f", raw, p)[0]
|
||||||
|
m = raw.find(b"MicL", k, k + _CHANNEL_BLOCK_SPAN)
|
||||||
|
if m >= 0:
|
||||||
|
out["trigger_level_mic_psi"] = struct.unpack_from(">f", raw, m + _TRIGGER_LEVEL_AFTER_LABEL)[0]
|
||||||
|
out["mic_type"] = int.from_bytes(raw[m + _MIC_TYPE_AFTER_LABEL:m + _MIC_TYPE_AFTER_LABEL + 4], "big")
|
||||||
|
out["mic_range"] = raw[m + _RANGE_AFTER_LABEL]
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
def read_blastware_file(path: Union[str, Path], *, name: Optional[str] = None) -> Event:
|
def read_blastware_file(path: Union[str, Path], *, name: Optional[str] = None) -> Event:
|
||||||
"""Parse a Blastware event file into an Event: `decode_blastware_bytes` on its
|
"""Parse a Blastware event file into an Event: `decode_blastware_bytes` on its
|
||||||
bytes, `name` defaulting to the file's own (see there -- never a time source)."""
|
bytes, `name` defaulting to the file's own (see there -- never a time source)."""
|
||||||
@@ -1150,12 +1522,14 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
|
|||||||
body = raw[body_start : footer_pos]
|
body = raw[body_start : footer_pos]
|
||||||
footer = raw[footer_pos : footer_pos + 26]
|
footer = raw[footer_pos : footer_pos + 26]
|
||||||
|
|
||||||
# Footer layout:
|
# Footer layout (the record chain's last record, id 0e: D.6.13):
|
||||||
# [0:2] 0e 08 marker
|
# [0:2] 0e 08 marker
|
||||||
# [2:10] ts1 (start) BE 8B
|
# [2:10] ts1 (start) BE 8B
|
||||||
# [10:18] ts2 (stop) BE 8B
|
# [10:18] ts2 (stop) BE 8B
|
||||||
# [18:24] 00 01 00 02 00 00
|
# [18:20] the monitor log's flag word (_monitor_log)
|
||||||
# [24:26] crc
|
# [20:22] the trigger source, as in the event record [22:24] 00 00
|
||||||
|
# [24:26] CRC-16/AUG-CCITT, BE, over the record's length prefix `00 1a`
|
||||||
|
# and [0:22]: 70,041 / 70,041 DL2 files (2026-11-11)
|
||||||
ts1 = _bw._decode_ts_be(footer[2:10])
|
ts1 = _bw._decode_ts_be(footer[2:10])
|
||||||
ts2 = _bw._decode_ts_be(footer[10:18])
|
ts2 = _bw._decode_ts_be(footer[10:18])
|
||||||
|
|
||||||
@@ -1195,8 +1569,10 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
|
|||||||
problems = []
|
problems = []
|
||||||
if record_type is None:
|
if record_type is None:
|
||||||
problems.append(f"unknown record type byte 0x{type_byte:02x} at STRT[18]")
|
problems.append(f"unknown record type byte 0x{type_byte:02x} at STRT[18]")
|
||||||
|
hist_records = None
|
||||||
if record_type == "Histogram":
|
if record_type == "Histogram":
|
||||||
decoded = decode_histogram_body(body)
|
hist_records = decode_histogram_body_full(body)
|
||||||
|
decoded = channels_from_records(hist_records)
|
||||||
is_waveform_body = False
|
is_waveform_body = False
|
||||||
elif record_type == "Waveform":
|
elif record_type == "Waveform":
|
||||||
decoded = decode_waveform_v2(body)
|
decoded = decode_waveform_v2(body)
|
||||||
@@ -1205,7 +1581,8 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
|
|||||||
decoded = decode_waveform_v2(body)
|
decoded = decode_waveform_v2(body)
|
||||||
is_waveform_body = decoded is not None
|
is_waveform_body = decoded is not None
|
||||||
if decoded is None:
|
if decoded is None:
|
||||||
decoded = decode_histogram_body(body)
|
hist_records = decode_histogram_body_full(body)
|
||||||
|
decoded = channels_from_records(hist_records)
|
||||||
if decoded is None:
|
if decoded is None:
|
||||||
log.warning(
|
log.warning(
|
||||||
"%s: body codec failed to decode (body starts %s) — "
|
"%s: body codec failed to decode (body starts %s) — "
|
||||||
@@ -1236,6 +1613,11 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
|
|||||||
ev.geo_range, range_problem = _setup_geo_range(raw)
|
ev.geo_range, range_problem = _setup_geo_range(raw)
|
||||||
if range_problem:
|
if range_problem:
|
||||||
ev.decode_problems.append(range_problem + "; peaks assume the Normal range")
|
ev.decode_problems.append(range_problem + "; peaks assume the Normal range")
|
||||||
|
k = _setup_name_at(raw)
|
||||||
|
if k is not None:
|
||||||
|
ev.device_info, ev.battery_volts = _setup_identity(raw, k)
|
||||||
|
for attr, value in _setup_trigger(raw, k).items():
|
||||||
|
setattr(ev, attr, value)
|
||||||
if is_waveform_body:
|
if is_waveform_body:
|
||||||
ev.rectime_seconds = _setup_record_time(raw)
|
ev.rectime_seconds = _setup_record_time(raw)
|
||||||
ev.total_samples = len(samples["Tran"]) or None
|
ev.total_samples = len(samples["Tran"]) or None
|
||||||
@@ -1266,17 +1648,21 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
|
|||||||
# embedded in the 5A stream (_embedded_event_record), so a waveform takes
|
# embedded in the 5A stream (_embedded_event_record), so a waveform takes
|
||||||
# it from there. Without a validated one the estimate stands, reported as a
|
# it from there. Without a validated one the estimate stands, reported as a
|
||||||
# decode problem -- never a filename's time, which is only a cross-check.
|
# decode problem -- never a filename's time, which is only a cross-check.
|
||||||
# Histograms stay on ts1 although it runs a second early on 97% (their
|
# A histogram's footer start runs a second early on 97%. Its own event
|
||||||
# record, marker fe f5, holds the exact start): in Blastware's timing a
|
# record (marker fe f5) holds Blastware's exact start and stop, so it takes
|
||||||
# waveform and its histogram share a second 209 times in prod's store, and
|
# them from there (#51); events are keyed unit + time + type, so a waveform
|
||||||
# events is unique on (serial, timestamp) -- #51.
|
# and its histogram may share a second.
|
||||||
|
# ⚠ RETRACTED 2026-11-03: "histograms stay on ts1" -- that held only while
|
||||||
|
# events were unique on (serial, timestamp).
|
||||||
|
_record_at = None # the validated event record, which the unit's summary follows
|
||||||
if is_waveform_body and ts2 is not None:
|
if is_waveform_body and ts2 is not None:
|
||||||
_stop = datetime.datetime(ts2.year, ts2.month, ts2.day,
|
_stop = datetime.datetime(ts2.year, ts2.month, ts2.day,
|
||||||
ts2.hour, ts2.minute, ts2.second)
|
ts2.hour, ts2.minute, ts2.second)
|
||||||
_rt = _parse_record_time_seconds(raw)
|
_rt = _parse_record_time_seconds(raw)
|
||||||
_start = (datetime.datetime(ts1.year, ts1.month, ts1.day, ts1.hour, ts1.minute, ts1.second)
|
_start = (datetime.datetime(ts1.year, ts1.month, ts1.day, ts1.hour, ts1.minute, ts1.second)
|
||||||
if ts1 is not None else None)
|
if ts1 is not None else None)
|
||||||
_trig, _why = _embedded_event_record(raw, footer_pos, _start, _stop, _rt)
|
_trig, _why, ev.triggered_by, _record_at = _embedded_event_record(
|
||||||
|
raw, footer_pos, _start, _stop, _rt)
|
||||||
if _trig is not None:
|
if _trig is not None:
|
||||||
ev.timestamp_source = "event_record"
|
ev.timestamp_source = "event_record"
|
||||||
else:
|
else:
|
||||||
@@ -1298,13 +1684,25 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
|
|||||||
hour=_trig.hour, minute=_trig.minute, second=_trig.second,
|
hour=_trig.hour, minute=_trig.minute, second=_trig.second,
|
||||||
)
|
)
|
||||||
elif ts1 is not None:
|
elif ts1 is not None:
|
||||||
|
_start, _hstop, _why, _record_at = (_histogram_event_record(raw, footer_pos, ts1, ts2)
|
||||||
|
if record_type == "Histogram" else (None, None, "", None))
|
||||||
|
if _start is not None:
|
||||||
|
ev.timestamp_source = "event_record"
|
||||||
|
ev.stop_time = _hstop
|
||||||
|
else:
|
||||||
|
_start = ts1
|
||||||
|
ev.timestamp_source = "footer"
|
||||||
|
if record_type == "Histogram":
|
||||||
|
_problem = (f"no validated histogram event record ({_why}); the start is the "
|
||||||
|
"footer's, a second early on 97% of measured files")
|
||||||
|
ev.decode_problems.append(_problem)
|
||||||
|
log.warning("%s: %s", label, _problem)
|
||||||
ev.timestamp = Timestamp(
|
ev.timestamp = Timestamp(
|
||||||
raw=footer[2:10],
|
raw=footer[2:10],
|
||||||
flag=0x10,
|
flag=0x10,
|
||||||
year=ts1.year, unknown_byte=0, month=ts1.month, day=ts1.day,
|
year=_start.year, unknown_byte=0, month=_start.month, day=_start.day,
|
||||||
hour=ts1.hour, minute=ts1.minute, second=ts1.second,
|
hour=_start.hour, minute=_start.minute, second=_start.second,
|
||||||
)
|
)
|
||||||
ev.timestamp_source = "footer"
|
|
||||||
|
|
||||||
ev.project_info = _setup_notes(raw)
|
ev.project_info = _setup_notes(raw)
|
||||||
ev.raw_samples = samples
|
ev.raw_samples = samples
|
||||||
@@ -1326,15 +1724,44 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
|
|||||||
has_samples = any(samples.get(ch) for ch in ("Tran", "Vert", "Long", "MicL"))
|
has_samples = any(samples.get(ch) for ch in ("Tran", "Vert", "Long", "MicL"))
|
||||||
# The geophone full scale is the file's range; Normal when it wasn't read.
|
# The geophone full scale is the file's range; Normal when it wasn't read.
|
||||||
geo_fs = _GEO_FS_BY_RANGE.get(ev.geo_range, _GEO_NORMAL_FS_INS)
|
geo_fs = _GEO_FS_BY_RANGE.get(ev.geo_range, _GEO_NORMAL_FS_INS)
|
||||||
ev.peak_values = _peaks_from_samples(samples, geo_fs) if has_samples else None
|
ev.peak_values = (_peaks_from_samples(samples, geo_fs, mic_count_divisor(ev.mic_range))
|
||||||
if not is_waveform_body and ev.peak_values is not None:
|
if has_samples else None)
|
||||||
# A histogram stores each interval's vector sum (squared); the event's
|
if (is_waveform_body and ev.peak_values is not None and ev.sample_rate
|
||||||
# is the largest. Combining the channel peaks instead read high on 86%
|
and ev.pretrig_samples is not None):
|
||||||
# of DL2's histograms -- they can come from different moments.
|
_waveform_peak_detail(ev.peak_values, samples, geo_fs, ev.sample_rate, ev.pretrig_samples)
|
||||||
pvs = interval_pvs(body)
|
_chain = _record_chain(raw, _record_at) if _record_at is not None else None
|
||||||
if pvs:
|
_summary = _unit_summary(_chain) if _chain is not None else None
|
||||||
ev.peak_values.peak_vector_sum = (
|
ev.sensor_check_results = _sensor_check_results(_chain) if _chain is not None else None
|
||||||
max(pvs) * _HIST_GEO_COUNTS_PER_UNIT * geo_fs / _GEO_INT16_FS)
|
# A whole chain ends at the file's last byte with the footer, so the last
|
||||||
|
# 26 bytes are proven to be it.
|
||||||
|
if _chain is not None and _FOOTER_ID in _chain:
|
||||||
|
ev.monitor_log = _monitor_log(raw[-_FOOTER_LEN:])
|
||||||
|
if _summary is not None and ev.peak_values is not None and ev.sample_rate:
|
||||||
|
_apply_unit_summary(ev.peak_values, _summary, geo_fs, ev.sample_rate,
|
||||||
|
ev.pretrig_samples if is_waveform_body else None)
|
||||||
|
if ev.stop_time is None: # a histogram's record stop, else the footer's
|
||||||
|
ev.stop_time = ts2
|
||||||
|
if hist_records:
|
||||||
|
# A histogram stores each interval's vector sum (squared), and each
|
||||||
|
# channel's half-period: Blastware's per-interval Geo PVS (771,354 /
|
||||||
|
# 771,354 DL2 cells) and frequency, (sample rate / 2) / half-period.
|
||||||
|
unit_ins = _HIST_GEO_COUNTS_PER_UNIT * geo_fs / _GEO_INT16_FS
|
||||||
|
ev.interval_pvs = [math.sqrt(r["pvs_sq"]) * unit_ins for r in hist_records]
|
||||||
|
ev.interval_half_periods = {
|
||||||
|
ch: [r[key] for r in hist_records if r[key] is not None]
|
||||||
|
for ch, key in (("Tran", "t_halfp"), ("Vert", "v_halfp"),
|
||||||
|
("Long", "l_halfp"), ("MicL", "m_halfp"))}
|
||||||
|
if not ev.interval_half_periods["MicL"]:
|
||||||
|
del ev.interval_half_periods["MicL"]
|
||||||
|
k = _setup_name_at(raw)
|
||||||
|
if k is not None and k >= _INTERVAL_BEFORE_NAME:
|
||||||
|
ev.histogram_interval_sec = int.from_bytes(
|
||||||
|
raw[k - _INTERVAL_BEFORE_NAME:k - _INTERVAL_BEFORE_NAME + 2], "big") or None
|
||||||
|
if not is_waveform_body and ev.peak_values is not None and ev.interval_pvs:
|
||||||
|
# The event's vector sum is the largest interval's. Combining the
|
||||||
|
# channel peaks instead read high on 86% of DL2's histograms -- they
|
||||||
|
# can come from different moments.
|
||||||
|
ev.peak_values.peak_vector_sum = max(ev.interval_pvs)
|
||||||
ev._a5_frames = None # not recoverable from BW file
|
ev._a5_frames = None # not recoverable from BW file
|
||||||
|
|
||||||
return ev
|
return ev
|
||||||
+17
-12
@@ -534,11 +534,13 @@ STRT_MARKER = b"STRT"
|
|||||||
def unescape_reply(data: bytes) -> bytes:
|
def unescape_reply(data: bytes) -> bytes:
|
||||||
"""A reply's data with each kept escape removed: `10 02/03/04` → `02/03/04`.
|
"""A reply's data with each kept escape removed: `10 02/03/04` → `02/03/04`.
|
||||||
|
|
||||||
The unit escapes 02, 03, 04 and 10 in its replies exactly as requests do
|
The unit escapes 02, 03, 04 and 10 in its replies exactly as requests do,
|
||||||
(748/748 replies, 2026-10-26). S3FrameParser collapses `10 10` but keeps the
|
the checksum included (748/748 replies, 2026-10-26; 7,747 / 7,747 across every
|
||||||
`10` of `10 02/03/04` (inner-frame markers to it), so its `.data` carries an
|
recording, March to October 2026, #58). S3FrameParser collapses `10 10` but
|
||||||
extra byte before each 02/03/04 value -- harmless for fields read before the
|
keeps the `10` of `10 02/03/04` (inner-frame markers to it) everywhere but the
|
||||||
escape, one byte off for any read after it, or counted from the end."""
|
checksum, so its `.data` carries an extra byte before each 02/03/04 value --
|
||||||
|
harmless for fields read before the escape, one byte off for any read after it,
|
||||||
|
or counted from the end."""
|
||||||
out, i = bytearray(), 0
|
out, i = bytearray(), 0
|
||||||
while i < len(data):
|
while i < len(data):
|
||||||
if data[i] == DLE and i + 1 < len(data) and data[i + 1] in (STX, ETX, 0x04):
|
if data[i] == DLE and i + 1 < len(data) and data[i + 1] in (STX, ETX, 0x04):
|
||||||
@@ -632,11 +634,8 @@ class S3Frame:
|
|||||||
page_lo: int # PAGE_LO from header
|
page_lo: int # PAGE_LO from header
|
||||||
data: bytes # payload data section (payload[5:], checksum already stripped)
|
data: bytes # payload data section (payload[5:], checksum already stripped)
|
||||||
checksum_valid: bool
|
checksum_valid: bool
|
||||||
chk_byte: int = 0 # actual checksum byte received from wire (body[-1])
|
chk_byte: int = 0 # actual checksum byte received from wire (body[-1]); an
|
||||||
# needed for waveform file reconstruction: when the last data byte
|
# escaped one (`10 02/03/04`) leaves no 10 in `data` (#58)
|
||||||
# is 0x10 and chk_byte ∈ {0x02, 0x03, 0x04}, the DLE+chk pair
|
|
||||||
# must be included in the DLE-strip operation to correctly
|
|
||||||
# reconstruct the Blastware binary body.
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def page_key(self) -> int:
|
def page_key(self) -> int:
|
||||||
@@ -759,9 +758,15 @@ class S3FrameParser:
|
|||||||
if len(body) < 6:
|
if len(body) < 6:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
raw_payload = body[:-1] # everything except the trailing checksum byte
|
# A checksum of 02, 03 or 04 arrives escaped, `10 X`, and _step keeps both
|
||||||
|
# bytes; that 10 is the escape, never data (#58: 272 of 7,747 recorded
|
||||||
|
# replies, every one an escape pair). Any other checksum is one byte.
|
||||||
|
n_chk = 2 if body[-2] == DLE and body[-1] in (STX, ETX, 0x04) else 1
|
||||||
|
raw_payload = body[:-n_chk] # everything except the checksum
|
||||||
chk_received = body[-1]
|
chk_received = body[-1]
|
||||||
chk_computed = checksum(raw_payload)
|
# SUM8 of the payload unescaped: the kept `10` of a `10 02/03/04` is not
|
||||||
|
# summed (7,747 of 7,747 recorded replies check this way).
|
||||||
|
chk_computed = checksum(unescape_reply(raw_payload))
|
||||||
|
|
||||||
if len(raw_payload) < 5:
|
if len(raw_payload) < 5:
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -156,10 +156,11 @@ _BLOCK_MARKER = 10
|
|||||||
# 16-count-unit output (1 unit = 0.005 in/s = 16 ADC counts).
|
# 16-count-unit output (1 unit = 0.005 in/s = 16 ADC counts).
|
||||||
_GEO_LSB_INS = 0.005
|
_GEO_LSB_INS = 0.005
|
||||||
|
|
||||||
# Frequency formula: freq_Hz = _FREQ_NUMERATOR / half_period_samples.
|
# Frequency formula: freq_Hz = (sample_rate / 2) / half_period_samples.
|
||||||
# Empirically determined to be 512 (= sample_rate / 2, where sample rate
|
# ⚠ RETRACTED 2026-11-03 (#50): "a fixed numerator of 512". 512 is sample_rate
|
||||||
# is 1024 sps for the standard MiniMate Plus configuration).
|
# / 2 at 1024 sps only; at 2048 sps it halved every frequency. Measured on DL2:
|
||||||
_FREQ_NUMERATOR = 512
|
# 527,915 / 527,915 cells at 1024 sps and 1,725 / 1,725 at 2048.
|
||||||
|
_FREQ_NUMERATOR = 512 # sample_rate / 2 at the default 1024 sps
|
||||||
|
|
||||||
|
|
||||||
def _is_data_block(block: bytes) -> bool:
|
def _is_data_block(block: bytes) -> bool:
|
||||||
@@ -300,7 +301,11 @@ def decode_histogram_body(body: bytes) -> Optional[dict]:
|
|||||||
to get 1-count ADC values, then ``count / 32767 * 10.0`` for in/s)
|
to get 1-count ADC values, then ``count / 32767 * 10.0`` for in/s)
|
||||||
- Mic channel: use ``waveform_codec.mic_count_to_db(count)``
|
- Mic channel: use ``waveform_codec.mic_count_to_db(count)``
|
||||||
"""
|
"""
|
||||||
records = _walk_auto(body)
|
return channels_from_records(_walk_auto(body))
|
||||||
|
|
||||||
|
|
||||||
|
def channels_from_records(records: Optional[List[dict]]) -> Optional[dict]:
|
||||||
|
"""``decode_histogram_body``'s per-channel peaks, from records already walked."""
|
||||||
if not records:
|
if not records:
|
||||||
return None
|
return None
|
||||||
return {
|
return {
|
||||||
@@ -338,17 +343,19 @@ def interval_pvs(body: bytes) -> Optional[List[float]]:
|
|||||||
return [math.sqrt(r["pvs_sq"]) for r in records] if records else None
|
return [math.sqrt(r["pvs_sq"]) for r in records] if records else None
|
||||||
|
|
||||||
|
|
||||||
def half_period_to_hz(halfp: int) -> Optional[float]:
|
def half_period_to_hz(halfp: int, sample_rate: int = 1024) -> Optional[float]:
|
||||||
"""Convert a half-period in samples to frequency in Hz.
|
"""Convert a half-period in samples to frequency in Hz:
|
||||||
|
``(sample_rate / 2) / halfp``.
|
||||||
|
|
||||||
Returns ``None`` for half-period ≤ 5 — the device emits values in
|
Returns ``None`` for half-period ≤ 5 — the device emits values in
|
||||||
that range when the measured zero-crossing rate exceeds 100 Hz
|
that range when the measured zero-crossing rate exceeds 100 Hz at
|
||||||
(the BW display reports `>100 Hz` for such cases). Callers can
|
1024 sps (the BW display reports `>100`, `>200` at 2048 sps). Callers
|
||||||
treat ``None`` as the `>100 Hz` sentinel.
|
can treat ``None`` as that sentinel. A half-period of 0 is Blastware's
|
||||||
|
"N/A"; it also returns None.
|
||||||
"""
|
"""
|
||||||
if halfp <= 5:
|
if halfp <= 5:
|
||||||
return None
|
return None
|
||||||
return _FREQ_NUMERATOR / halfp
|
return (sample_rate / 2) / halfp
|
||||||
|
|
||||||
|
|
||||||
def geo_count_to_ins(count: int) -> float:
|
def geo_count_to_ins(count: int) -> float:
|
||||||
|
|||||||
@@ -0,0 +1,185 @@
|
|||||||
|
"""
|
||||||
|
minimateplus/mlg_file.py — Blastware's monitor log (.MLG): reader and writer.
|
||||||
|
|
||||||
|
Blastware writes one .MLG per call-in, named <serial><counter>.MLG, holding what
|
||||||
|
the unit logged since the previous call-in: each time monitoring started, each
|
||||||
|
event, and each time it stopped and why. Measured on 1,273 DL2 files and 9
|
||||||
|
bench files (2026-11-09; reference D.4, spec
|
||||||
|
docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md):
|
||||||
|
|
||||||
|
[18-byte prefix 10 00 01 80 00 00 "Instantel\\0" 07 2c]
|
||||||
|
[292-byte records ...] size is always 18 + 292*n
|
||||||
|
|
||||||
|
Every record:
|
||||||
|
[0:2] length, uint16 LE = 290
|
||||||
|
[2:4] id: 0e a0 the header record (first, carries the serial), 0e 80 a log record
|
||||||
|
[4:12] start: day, month, year LE, 0, hour, minute, second
|
||||||
|
[12:20] stop, same format; all zeros = no stop
|
||||||
|
[20:22] monitor-log flag word, uint16 LE (the event footer's, D.6.14); 0xFFFF = started
|
||||||
|
[22:24] trigger source, uint16 LE: 0x0001-0x0008 a channel, 0x0400 a histogram
|
||||||
|
[24:34] serial, NUL-padded ASCII
|
||||||
|
[34:288] text, NUL-padded; an event's starts 0x08 + its 8-byte time
|
||||||
|
[288:290] 00 00
|
||||||
|
[290:292] CRC-16/AUG-CCITT over [0:288], little-endian
|
||||||
|
|
||||||
|
An empty file is the prefix alone: no header record, no serial. Pure: no I/O
|
||||||
|
beyond reading the path it is given.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import struct
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
from .crc import crc16_aug_ccitt
|
||||||
|
from .event_file_io import monitor_log_description
|
||||||
|
from .models import MlgFile, MlgRecord
|
||||||
|
|
||||||
|
MLG_PREFIX = b"\x10\x00\x01\x80\x00\x00Instantel\x00\x07\x2c"
|
||||||
|
RECORD_SIZE = 292
|
||||||
|
_RECORD_LENGTH = 290
|
||||||
|
_HEADER_ID = b"\x0e\xa0"
|
||||||
|
_LOG_ID = b"\x0e\x80"
|
||||||
|
_EVENT_TIME_MARK = 0x08
|
||||||
|
_TRIGGER_LEVEL_PREFIXES = ("Trigger Level :", "Trigger Level:")
|
||||||
|
|
||||||
|
|
||||||
|
class MlgFormatError(ValueError):
|
||||||
|
"""The bytes are not a whole .MLG file."""
|
||||||
|
|
||||||
|
|
||||||
|
def _ts(raw: bytes) -> Optional[datetime.datetime]:
|
||||||
|
"""8-byte MLG time (year little-endian); all zeros = None. Raises ValueError."""
|
||||||
|
if raw == bytes(8):
|
||||||
|
return None
|
||||||
|
year = struct.unpack_from("<H", raw, 2)[0]
|
||||||
|
return datetime.datetime(year, raw[1], raw[0], raw[5], raw[6], raw[7])
|
||||||
|
|
||||||
|
|
||||||
|
def _crc_ok(record: bytes) -> bool:
|
||||||
|
return crc16_aug_ccitt(record[:288]) == struct.unpack_from("<H", record, 290)[0]
|
||||||
|
|
||||||
|
|
||||||
|
def _trigger_level(text: str) -> Optional[str]:
|
||||||
|
line = text.split("\r", 1)[0]
|
||||||
|
for prefix in _TRIGGER_LEVEL_PREFIXES:
|
||||||
|
if line.startswith(prefix):
|
||||||
|
line = line[len(prefix):]
|
||||||
|
break
|
||||||
|
line = line.strip()
|
||||||
|
return line or None
|
||||||
|
|
||||||
|
|
||||||
|
def _log_record(index: int, rec: bytes) -> MlgRecord:
|
||||||
|
try:
|
||||||
|
start = _ts(rec[4:12])
|
||||||
|
stop = _ts(rec[12:20])
|
||||||
|
except ValueError as exc:
|
||||||
|
raise MlgFormatError(f"record {index}: a time cannot be decoded ({exc})") from None
|
||||||
|
if start is None:
|
||||||
|
raise MlgFormatError(f"record {index}: no start time")
|
||||||
|
flags, source = struct.unpack_from("<HH", rec, 20)
|
||||||
|
text_raw = rec[34:288]
|
||||||
|
body, event_time = text_raw, None
|
||||||
|
if text_raw[0] == _EVENT_TIME_MARK:
|
||||||
|
try:
|
||||||
|
event_time = _ts(text_raw[1:9])
|
||||||
|
except ValueError as exc:
|
||||||
|
raise MlgFormatError(f"record {index}: the event time cannot be decoded ({exc})") from None
|
||||||
|
body = text_raw[9:]
|
||||||
|
text = body.split(b"\x00", 1)[0].decode("latin-1")
|
||||||
|
is_start = flags == 0xFFFF
|
||||||
|
return MlgRecord(
|
||||||
|
index=index,
|
||||||
|
start=start,
|
||||||
|
stop=stop,
|
||||||
|
flags=flags,
|
||||||
|
trigger_source=source,
|
||||||
|
serial=rec[24:34].split(b"\x00", 1)[0].decode("ascii", errors="replace"),
|
||||||
|
text_raw=text_raw,
|
||||||
|
event_time=event_time,
|
||||||
|
text=text,
|
||||||
|
trigger_level=_trigger_level(text),
|
||||||
|
description="Monitoring started" if is_start else monitor_log_description(flags).strip(),
|
||||||
|
crc_ok=_crc_ok(rec),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_mlg(data: bytes) -> MlgFile:
|
||||||
|
"""Parse the bytes of a .MLG file.
|
||||||
|
|
||||||
|
Raises MlgFormatError when the bytes are not a whole .MLG. A record whose
|
||||||
|
checksum fails is returned with crc_ok=False (MlgFile.crc_failures lists
|
||||||
|
them); the caller decides what to do with it."""
|
||||||
|
if len(data) < len(MLG_PREFIX) or not data.startswith(MLG_PREFIX):
|
||||||
|
raise MlgFormatError("not an MLG: the 18-byte Instantel prefix is missing")
|
||||||
|
body = data[len(MLG_PREFIX):]
|
||||||
|
if len(body) % RECORD_SIZE:
|
||||||
|
raise MlgFormatError(f"not an MLG: size {len(data)} is not 18 + 292*n")
|
||||||
|
records = [body[i:i + RECORD_SIZE] for i in range(0, len(body), RECORD_SIZE)]
|
||||||
|
if not records:
|
||||||
|
return MlgFile(serial=None)
|
||||||
|
for index, rec in enumerate(records):
|
||||||
|
length = struct.unpack_from("<H", rec, 0)[0]
|
||||||
|
if length != _RECORD_LENGTH:
|
||||||
|
raise MlgFormatError(f"record {index}: length field {length}, expected 290")
|
||||||
|
expected = _HEADER_ID if index == 0 else _LOG_ID
|
||||||
|
if rec[2:4] != expected:
|
||||||
|
raise MlgFormatError(f"record {index}: id {rec[2:4].hex()}, expected {expected.hex()}")
|
||||||
|
header = records[0]
|
||||||
|
return MlgFile(
|
||||||
|
serial=header[24:34].split(b"\x00", 1)[0].decode("ascii", errors="replace"),
|
||||||
|
records=[_log_record(i, rec) for i, rec in enumerate(records) if i > 0],
|
||||||
|
header_crc_ok=_crc_ok(header),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def read_mlg(path: Union[str, Path]) -> MlgFile:
|
||||||
|
"""Read and parse a .MLG file."""
|
||||||
|
return parse_mlg(Path(path).read_bytes())
|
||||||
|
|
||||||
|
|
||||||
|
# ── Writer ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def _ts_bytes(ts: Optional[datetime.datetime]) -> bytes:
|
||||||
|
if ts is None:
|
||||||
|
return bytes(8)
|
||||||
|
return bytes([ts.day, ts.month]) + struct.pack("<H", ts.year) + bytes([0, ts.hour, ts.minute, ts.second])
|
||||||
|
|
||||||
|
|
||||||
|
def _serial_field(serial: str) -> bytes:
|
||||||
|
return serial.encode("ascii", errors="replace")[:10].ljust(10, b"\x00")
|
||||||
|
|
||||||
|
|
||||||
|
def _sealed(body: bytes) -> bytes:
|
||||||
|
"""`body` is record[0:288]; append the two zero bytes and the LE checksum."""
|
||||||
|
return body + b"\x00\x00" + struct.pack("<H", crc16_aug_ccitt(body))
|
||||||
|
|
||||||
|
|
||||||
|
def _header_record(serial: str) -> bytes:
|
||||||
|
# Every byte but the serial is zero on all 1,273 DL2 files (measured 2026-11-13).
|
||||||
|
body = struct.pack("<H", _RECORD_LENGTH) + _HEADER_ID + bytes(20) + _serial_field(serial)
|
||||||
|
return _sealed(body.ljust(288, b"\x00"))
|
||||||
|
|
||||||
|
|
||||||
|
def _log_record_bytes(r: MlgRecord) -> bytes:
|
||||||
|
body = (struct.pack("<H", _RECORD_LENGTH) + _LOG_ID + _ts_bytes(r.start) + _ts_bytes(r.stop)
|
||||||
|
+ struct.pack("<HH", r.flags, r.trigger_source) + _serial_field(r.serial)
|
||||||
|
+ r.text_raw.ljust(254, b"\x00")[:254])
|
||||||
|
return _sealed(body)
|
||||||
|
|
||||||
|
|
||||||
|
def mlg_bytes(mlg: MlgFile) -> bytes:
|
||||||
|
"""The bytes of a .MLG file, as Blastware writes them: little-endian times,
|
||||||
|
length-led records, each record's checksum computed. An empty MlgFile is
|
||||||
|
the prefix alone."""
|
||||||
|
if mlg.empty:
|
||||||
|
return MLG_PREFIX
|
||||||
|
return MLG_PREFIX + _header_record(mlg.serial or "") + b"".join(_log_record_bytes(r) for r in mlg.records)
|
||||||
|
|
||||||
|
|
||||||
|
def write_mlg(mlg: MlgFile, path: Union[str, Path]) -> None:
|
||||||
|
"""Write `mlg` to `path` (see mlg_bytes)."""
|
||||||
|
Path(path).write_bytes(mlg_bytes(mlg))
|
||||||
@@ -300,6 +300,10 @@ class DeviceInfo:
|
|||||||
# ── From SUB 08 (EVENT_INDEX_RESPONSE) ────────────────────────────────────
|
# ── From SUB 08 (EVENT_INDEX_RESPONSE) ────────────────────────────────────
|
||||||
event_count: Optional[int] = None # stored event count from F7 response 🔶
|
event_count: Optional[int] = None # stored event count from F7 response 🔶
|
||||||
|
|
||||||
|
# ── From a Blastware event file's identity block (2026-11-03) ─────────────
|
||||||
|
calibration_date: Optional[datetime.date] = None # e.g. 2019-02-20 ✅
|
||||||
|
calibrated_by: Optional[str] = None # e.g. "Instantel" ✅
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
fw = self.firmware_version or f"?.{self.firmware_minor}"
|
fw = self.firmware_version or f"?.{self.firmware_minor}"
|
||||||
mdl = self.model or "MiniMate Plus"
|
mdl = self.model or "MiniMate Plus"
|
||||||
@@ -352,6 +356,9 @@ class PeakValues:
|
|||||||
long: Optional[float] = None # Longitudinal PPV (in/s) ✅
|
long: Optional[float] = None # Longitudinal PPV (in/s) ✅
|
||||||
micl: Optional[float] = None # Air overpressure (psi) 🔶 (units uncertain)
|
micl: Optional[float] = None # Air overpressure (psi) 🔶 (units uncertain)
|
||||||
peak_vector_sum: Optional[float] = None # Scalar geo PVS (in/s) ✅
|
peak_vector_sum: Optional[float] = None # Scalar geo PVS (in/s) ✅
|
||||||
|
# ZC frequency (Hz), from the unit's own summary in the file (2026-11-05) or
|
||||||
|
# a report. Above range, the value is Blastware's threshold (100 Hz at
|
||||||
|
# 1024 sps) and the flag is set; None is Blastware's "N/A".
|
||||||
tran_zc_freq: Optional[float] = None
|
tran_zc_freq: Optional[float] = None
|
||||||
vert_zc_freq: Optional[float] = None
|
vert_zc_freq: Optional[float] = None
|
||||||
long_zc_freq: Optional[float] = None
|
long_zc_freq: Optional[float] = None
|
||||||
@@ -360,6 +367,50 @@ class PeakValues:
|
|||||||
vert_zc_above_range: bool = False
|
vert_zc_above_range: bool = False
|
||||||
long_zc_above_range: bool = False
|
long_zc_above_range: bool = False
|
||||||
mic_zc_above_range: bool = False
|
mic_zc_above_range: bool = False
|
||||||
|
# A waveform's peak detail (2026-11-04); None for a histogram. Times of peak
|
||||||
|
# are the unit's own peak samples, acceleration comes from the samples.
|
||||||
|
tran_time_of_peak: Optional[float] = None # s from the trigger; negative = pre-trigger
|
||||||
|
vert_time_of_peak: Optional[float] = None
|
||||||
|
long_time_of_peak: Optional[float] = None
|
||||||
|
micl_time_of_peak: Optional[float] = None
|
||||||
|
pvs_time: Optional[float] = None # s from the trigger, of the vector-sum peak
|
||||||
|
tran_peak_accel_g: Optional[float] = None
|
||||||
|
vert_peak_accel_g: Optional[float] = None
|
||||||
|
long_peak_accel_g: Optional[float] = None
|
||||||
|
# Peak displacement (in), from the unit's own summary (2026-11-05).
|
||||||
|
tran_peak_disp_in: Optional[float] = None
|
||||||
|
vert_peak_disp_in: Optional[float] = None
|
||||||
|
long_peak_disp_in: Optional[float] = None
|
||||||
|
# Over range: the unit's own peak passed full scale (2026-11-09). Blastware
|
||||||
|
# prints OORANGE for that peak, and for the vector sum when any geophone is
|
||||||
|
# over; the value beside it is then a lower bound.
|
||||||
|
tran_over_range: bool = False
|
||||||
|
vert_over_range: bool = False
|
||||||
|
long_over_range: bool = False
|
||||||
|
mic_over_range: bool = False
|
||||||
|
pvs_over_range: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SensorCheckResult:
|
||||||
|
"""One channel's sensor check, as the unit stores it in the event file
|
||||||
|
(2026-11-06). `result` is Blastware's word for it."""
|
||||||
|
result: str # "Passed", "Check" or "Disabled"
|
||||||
|
status: int # the unit's code: 0 passed; its bits are not decoded
|
||||||
|
freq_hz: Optional[float] = None # geophone resonance / mic test frequency; None when Disabled
|
||||||
|
ratio: Optional[float] = None # geophones only
|
||||||
|
amplitude_mv: Optional[int] = None # the mic only
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class MonitorLogLine:
|
||||||
|
"""The Monitor Log line Blastware prints for an event, from the file's
|
||||||
|
footer (2026-11-08): the monitoring session's start, the stop, and what
|
||||||
|
happened. Not the live 0x0A browse entries (MonitorLogEntry)."""
|
||||||
|
start: datetime.datetime
|
||||||
|
stop: datetime.datetime
|
||||||
|
flags: int # the footer's flag word
|
||||||
|
description: str # Blastware's words, e.g. "Event Recorded Modem Exit"
|
||||||
|
|
||||||
|
|
||||||
# ── Project / operator metadata ───────────────────────────────────────────────
|
# ── Project / operator metadata ───────────────────────────────────────────────
|
||||||
@@ -548,6 +599,21 @@ class Event:
|
|||||||
# Geophone range from the recording setup, as ComplianceConfig.geo_range:
|
# Geophone range from the recording setup, as ComplianceConfig.geo_range:
|
||||||
# 0 Normal (10 in/s full scale), 1 Sensitive (1.25 in/s). None: not read.
|
# 0 Normal (10 in/s full scale), 1 Sensitive (1.25 in/s). None: not read.
|
||||||
geo_range: Optional[int] = None
|
geo_range: Optional[int] = None
|
||||||
|
# From a Blastware event file (2026-11-03); None when not read.
|
||||||
|
device_info: Optional["DeviceInfo"] = None # the unit, as SUB FE reports it
|
||||||
|
battery_volts: Optional[float] = None # at the event
|
||||||
|
triggered_by: Optional[int] = None # 0x01 Tran 0x02 Vert 0x04 Long 0x08 MicL 0x200 Manual
|
||||||
|
trigger_sources: Optional[int] = None # setup bitmask: 0x07 geophones, 0x08 mic
|
||||||
|
trigger_level_geo: Optional[float] = None # in/s, as ComplianceConfig.trigger_level_geo
|
||||||
|
trigger_level_mic_psi: Optional[float] = None
|
||||||
|
record_stop_mode: Optional[int] = None # 0 = Fixed
|
||||||
|
mic_type: Optional[int] = None # 2 = Linear Weighting (as Series IV)
|
||||||
|
mic_range: Optional[int] = None # 0; 1 = each mic count is an eighth (2026-11-09)
|
||||||
|
stop_time: Optional[datetime.datetime] = None # the footer's stop
|
||||||
|
# A histogram's per-interval detail (2026-11-03); None for a waveform.
|
||||||
|
histogram_interval_sec: Optional[int] = None # as ComplianceConfig.histogram_interval_sec
|
||||||
|
interval_half_periods: Optional[dict] = None # channel -> half-period per interval, samples
|
||||||
|
interval_pvs: Optional[list] = None # each interval's vector sum, in/s
|
||||||
|
|
||||||
# Sensor self-check traces keyed by channel label — the short diagnostic
|
# Sensor self-check traces keyed by channel label — the short diagnostic
|
||||||
# waveforms the unit records when it pulses each sensor before monitoring
|
# waveforms the unit records when it pulses each sensor before monitoring
|
||||||
@@ -557,6 +623,12 @@ class Event:
|
|||||||
# Raw ADC counts; the source series' scale differs but the trace is a
|
# Raw ADC counts; the source series' scale differs but the trace is a
|
||||||
# shape diagnostic (rendered fit-to-box). None when absent.
|
# shape diagnostic (rendered fit-to-box). None when absent.
|
||||||
sensor_check: Optional[dict] = None # {"Tran": [...], ..., "MicL": [...]}
|
sensor_check: Optional[dict] = None # {"Tran": [...], ..., "MicL": [...]}
|
||||||
|
# And its results per channel, from the same records (2026-11-06): None
|
||||||
|
# when the file's record chain is not whole.
|
||||||
|
sensor_check_results: Optional[dict] = None # channel -> SensorCheckResult
|
||||||
|
# The event's Monitor Log line (2026-11-08): None unless the file's record
|
||||||
|
# chain is whole, which proves the footer.
|
||||||
|
monitor_log: Optional[MonitorLogLine] = None
|
||||||
|
|
||||||
# Where `timestamp` came from, when decoded from a Blastware binary
|
# Where `timestamp` came from, when decoded from a Blastware binary
|
||||||
# (event_file_io): "event_record" -- the instrument's own event record in
|
# (event_file_io): "event_record" -- the instrument's own event record in
|
||||||
@@ -657,6 +729,52 @@ class MonitorLogEntry:
|
|||||||
return f"MonitorLog#{self.index} key={self.key} {start}→{stop}{dur}"
|
return f"MonitorLog#{self.index} key={self.key} {start}→{stop}{dur}"
|
||||||
|
|
||||||
|
|
||||||
|
# ── Blastware monitor log (.MLG) ──────────────────────────────────────────────
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class MlgRecord:
|
||||||
|
"""One log record of a Blastware .MLG file (minimateplus/mlg_file.py).
|
||||||
|
|
||||||
|
Times are the unit's own local clock. `flags` is the monitor-log flag word
|
||||||
|
(the event footer's, reference D.6.14); 0xFFFF means monitoring started
|
||||||
|
and has no stop yet."""
|
||||||
|
index: int # position in the file; 0 is the header record
|
||||||
|
start: datetime.datetime
|
||||||
|
stop: Optional[datetime.datetime]
|
||||||
|
flags: int
|
||||||
|
trigger_source: int # 0x0001-0x0008 a channel, 0x0400 a histogram, 0 none
|
||||||
|
serial: str
|
||||||
|
text_raw: bytes = field(repr=False) # record[34:288] exactly, for write_mlg
|
||||||
|
event_time: Optional[datetime.datetime] = None
|
||||||
|
text: str = "" # Blastware's text, after any event time
|
||||||
|
trigger_level: Optional[str] = None # e.g. "Geo: 0.0500 in/s Mic: 125.0 dB(L)", "Histogram"
|
||||||
|
description: str = "" # "Monitoring started", or Blastware's words
|
||||||
|
crc_ok: bool = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_start(self) -> bool:
|
||||||
|
return self.flags == 0xFFFF
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class MlgFile:
|
||||||
|
"""A whole .MLG file: the serial from its header record and its log records,
|
||||||
|
in file order. An empty file (the 18-byte prefix alone) has neither."""
|
||||||
|
serial: Optional[str]
|
||||||
|
records: list[MlgRecord] = field(default_factory=list)
|
||||||
|
header_crc_ok: bool = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def empty(self) -> bool:
|
||||||
|
return self.serial is None and not self.records
|
||||||
|
|
||||||
|
@property
|
||||||
|
def crc_failures(self) -> list[int]:
|
||||||
|
"""Indexes of the records whose checksum fails (0 is the header record)."""
|
||||||
|
head = [] if self.header_crc_ok else [0]
|
||||||
|
return head + [r.index for r in self.records if not r.crc_ok]
|
||||||
|
|
||||||
|
|
||||||
# ── MonitorStatus ─────────────────────────────────────────────────────────────
|
# ── MonitorStatus ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
+82
-12
@@ -142,9 +142,14 @@ _WRITE_TAIL = {SUB_EVENT_INDEX_WRITE: b"\x02\x00", SUB_TRIGGER_CONFIG_WRITE: b"\
|
|||||||
SUB_CALL_HOME_WRITE: b"\x00\x00"}
|
SUB_CALL_HOME_WRITE: b"\x00\x00"}
|
||||||
|
|
||||||
|
|
||||||
def write_image(sub: int, data: bytes) -> bytes:
|
def write_image(sub: int, data: bytes, *, escaped: bool = True) -> bytes:
|
||||||
"""The whole block a write sends: `data` unescaped, N + 2 bytes.
|
"""The whole block a write sends: `data` unescaped, N + 2 bytes.
|
||||||
|
|
||||||
|
`escaped=False`: `data` is already logical (every block read since phase 5 --
|
||||||
|
read_event_index, read_compliance_content, read_trigger_config,
|
||||||
|
read_waveform_data_raw -- returns unescaped bytes), so it is NOT unescaped
|
||||||
|
again: a logical `10 02` (job number 4098) would otherwise collapse.
|
||||||
|
|
||||||
A config block starts with its own length N (uint16 BE) and is written as N
|
A config block starts with its own length N (uint16 BE) and is written as N
|
||||||
bytes plus two -- on every Blastware write on record. `data` may be the
|
bytes plus two -- on every Blastware write on record. `data` may be the
|
||||||
block as a read returned it (N bytes, or N + 2) and may still hold the
|
block as a read returned it (N bytes, or N + 2) and may still hold the
|
||||||
@@ -152,7 +157,7 @@ def write_image(sub: int, data: bytes) -> bytes:
|
|||||||
Anything else is refused before a byte is sent: a block one byte longer than
|
Anything else is refused before a byte is sent: a block one byte longer than
|
||||||
its header says is what an edit beside a kept escape byte leaves behind.
|
its header says is what an edit beside a kept escape byte leaves behind.
|
||||||
"""
|
"""
|
||||||
image = unescape_reply(bytes(data))
|
image = unescape_reply(bytes(data)) if escaped else bytes(data)
|
||||||
if len(image) < 2:
|
if len(image) < 2:
|
||||||
raise ValueError(f"write SUB 0x{sub:02X}: {len(image)} bytes is not a whole block")
|
raise ValueError(f"write SUB 0x{sub:02X}: {len(image)} bytes is not a whole block")
|
||||||
n = int.from_bytes(image[:2], "big")
|
n = int.from_bytes(image[:2], "big")
|
||||||
@@ -169,6 +174,46 @@ class ImageRefused(ValueError):
|
|||||||
"""A write refused before any byte was sent: the image is not a whole block."""
|
"""A write refused before any byte was sent: the image is not a whole block."""
|
||||||
|
|
||||||
|
|
||||||
|
# ── The settings block (SUB 1A), as content ─────────────────────────────────
|
||||||
|
#
|
||||||
|
# Measured 2026-11-03 on BE9441's 10-26 recording (12 reads, both Blastware's
|
||||||
|
# 4 x 512 + 42 pattern and SFM's 1024 + 1024 + 42): unescape each data frame and
|
||||||
|
# take data[11:]; every frame but the last then starts with one `00` that is not
|
||||||
|
# content. Dropped, the frames join into 2,090 bytes that start with their own
|
||||||
|
# length N = 2090 -- Series IV's 0x1A content layout -- and the read after each
|
||||||
|
# of Blastware's two writes equals the image it had just written.
|
||||||
|
# tests/test_s3_settings_read.py.
|
||||||
|
|
||||||
|
COMPLIANCE_CONTENT_LEN = 2090
|
||||||
|
# SFM's 1A read: (offset = the content length asked for, page) per data frame.
|
||||||
|
_COMPLIANCE_READ_STEPS = ((0x0400, 0x00), (0x0400, 0x04), (0x002A, 0x08))
|
||||||
|
|
||||||
|
|
||||||
|
def assemble_compliance_content(frames: "list[bytes]", lengths: "Optional[tuple]" = None) -> bytes:
|
||||||
|
"""Join a 1A read's data frames (each S3Frame.data, kept escapes and all, in
|
||||||
|
order) into the logical settings block. Judges nothing: a monitoring unit's
|
||||||
|
device-info answer assembles too -- `is_compliance_content` tells them apart.
|
||||||
|
|
||||||
|
`lengths`: the content each frame was asked for (SFM's read: 1024, 1024, 42).
|
||||||
|
Each frame then gives exactly that. Measured at the bench 2026-11-04 (BE9441):
|
||||||
|
when a frame's checksum byte was itself escaped (02 / 03 / 04), the parser kept
|
||||||
|
the escape's 0x10, so the frame arrived one byte long, ending in a lone 0x10.
|
||||||
|
The parser drops it since #58; this trim stays as a guard. That one byte is
|
||||||
|
dropped; any other leftover is kept, and the block then fails
|
||||||
|
is_compliance_content."""
|
||||||
|
parts = [unescape_reply(bytes(f))[11:] for f in frames]
|
||||||
|
parts = [p[1:] for p in parts[:-1]] + parts[-1:]
|
||||||
|
if lengths is not None and len(lengths) == len(parts):
|
||||||
|
parts = [p[:n] if p[n:] == b"\x10" else p for p, n in zip(parts, lengths)]
|
||||||
|
return b"".join(parts)
|
||||||
|
|
||||||
|
|
||||||
|
def is_compliance_content(block: bytes) -> bool:
|
||||||
|
"""Whether `block` is the settings block: 2,090 bytes headed by N = 2090."""
|
||||||
|
return (len(block) == COMPLIANCE_CONTENT_LEN
|
||||||
|
and int.from_bytes(block[0:2], "big") == COMPLIANCE_CONTENT_LEN)
|
||||||
|
|
||||||
|
|
||||||
def is_call_home_block(raw: bytes) -> bool:
|
def is_call_home_block(raw: bytes) -> bool:
|
||||||
"""Whether a 0x2C reply payload is the call-home block: it starts with its own
|
"""Whether a 0x2C reply payload is the call-home block: it starts with its own
|
||||||
length N = 0x7C (00 7C DC on every read on record) and is N (or N + 2) bytes
|
length N = 0x7C (00 7C DC on every read on record) and is N (or N + 2) bytes
|
||||||
@@ -589,6 +634,11 @@ class MiniMateProtocol:
|
|||||||
data_rsp = self._recv_one(expected_sub=rsp_sub)
|
data_rsp = self._recv_one(expected_sub=rsp_sub)
|
||||||
|
|
||||||
raw = unescape_reply(data_rsp.data)[11:] # unescaped, as read_event_index
|
raw = unescape_reply(data_rsp.data)[11:] # unescaped, as read_event_index
|
||||||
|
# An escaped checksum byte left its 0x10 behind until #58 (bench 2026-11-04;
|
||||||
|
# see assemble_compliance_content): kept as a guard, one stray byte beyond
|
||||||
|
# what was asked is dropped.
|
||||||
|
if len(raw) == length + 1 and raw[-1:] == b"\x10":
|
||||||
|
raw = raw[:-1]
|
||||||
log.debug("read_waveform_data_raw: got %d bytes", len(raw))
|
log.debug("read_waveform_data_raw: got %d bytes", len(raw))
|
||||||
return raw
|
return raw
|
||||||
|
|
||||||
@@ -1029,6 +1079,25 @@ class MiniMateProtocol:
|
|||||||
|
|
||||||
return bytes(config)
|
return bytes(config)
|
||||||
|
|
||||||
|
def read_compliance_content(self) -> bytes:
|
||||||
|
"""The 1A read as the logical settings block (see assemble_compliance_content).
|
||||||
|
|
||||||
|
The same requests as read_compliance_config -- probe, then B / C / D -- but
|
||||||
|
strict: a data frame that does not arrive raises, and there is no tail
|
||||||
|
drain, so a short read is never assembled. Returns whatever assembled,
|
||||||
|
unjudged; a MONITORING unit answers with its device-info block, which
|
||||||
|
is_compliance_content() rejects.
|
||||||
|
"""
|
||||||
|
rsp_sub = _expected_rsp_sub(SUB_COMPLIANCE)
|
||||||
|
self._send(build_bw_frame(SUB_COMPLIANCE, 0, bytes([0, 0, 0, 0, 0, 0, 0, 0x64, 0, 0])))
|
||||||
|
self._recv_one(expected_sub=rsp_sub)
|
||||||
|
frames = []
|
||||||
|
for offset, page in _COMPLIANCE_READ_STEPS:
|
||||||
|
self._send(build_bw_frame(SUB_COMPLIANCE, offset,
|
||||||
|
bytes([0, 0, page, 0, 0, 0, 0, 0x64, 0, 0])))
|
||||||
|
frames.append(self._recv_one(expected_sub=rsp_sub).data)
|
||||||
|
return assemble_compliance_content(frames, lengths=tuple(o for o, _ in _COMPLIANCE_READ_STEPS))
|
||||||
|
|
||||||
# ── Write commands (SUBs 68–83) ───────────────────────────────────────────
|
# ── Write commands (SUBs 68–83) ───────────────────────────────────────────
|
||||||
|
|
||||||
def recv_write_ack(
|
def recv_write_ack(
|
||||||
@@ -1086,25 +1155,26 @@ class MiniMateProtocol:
|
|||||||
self._send(frame)
|
self._send(frame)
|
||||||
return self.recv_write_ack(expected_sub=rsp_sub)
|
return self.recv_write_ack(expected_sub=rsp_sub)
|
||||||
|
|
||||||
def _write_block(self, sub: int, data: bytes, params: bytes = bytes(10)) -> S3Frame:
|
def _write_block(self, sub: int, data: bytes, params: bytes = bytes(10), *,
|
||||||
|
escaped: bool = True) -> S3Frame:
|
||||||
"""Send one config block as a write and return its ack (0xFF - sub)."""
|
"""Send one config block as a write and return its ack (0xFF - sub)."""
|
||||||
image = write_image(sub, data)
|
image = write_image(sub, data, escaped=escaped)
|
||||||
frame = build_bw_write_frame(sub, image, params=params)
|
frame = build_bw_write_frame(sub, image, params=params)
|
||||||
log.debug("write SUB=0x%02X: %d-byte image", sub, len(image))
|
log.debug("write SUB=0x%02X: %d-byte image", sub, len(image))
|
||||||
self._send(frame)
|
self._send(frame)
|
||||||
return self.recv_write_ack(expected_sub=_expected_rsp_sub(sub))
|
return self.recv_write_ack(expected_sub=_expected_rsp_sub(sub))
|
||||||
|
|
||||||
def write_event_index(self, data: bytes) -> S3Frame:
|
def write_event_index(self, data: bytes, *, escaped: bool = True) -> S3Frame:
|
||||||
"""SUB 68: write the event-index block (as SUB 08 read it). Ack 0x97;
|
"""SUB 68: write the event-index block (as SUB 08 read it). Ack 0x97;
|
||||||
callers follow with write_confirm(SUB_WRITE_CONFIRM_B). See write_image."""
|
callers follow with write_confirm(SUB_WRITE_CONFIRM_B). See write_image."""
|
||||||
return self._write_block(SUB_EVENT_INDEX_WRITE, data)
|
return self._write_block(SUB_EVENT_INDEX_WRITE, data, escaped=escaped)
|
||||||
|
|
||||||
def write_waveform_data(self, data: bytes) -> S3Frame:
|
def write_waveform_data(self, data: bytes, *, escaped: bool = True) -> S3Frame:
|
||||||
"""SUB 69: write the waveform-data block (as SUB 09 read it). Ack 0x96;
|
"""SUB 69: write the waveform-data block (as SUB 09 read it). Ack 0x96;
|
||||||
callers follow with write_confirm C then A. See write_image."""
|
callers follow with write_confirm C then A. See write_image."""
|
||||||
return self._write_block(SUB_WAVEFORM_DATA_WRITE, data)
|
return self._write_block(SUB_WAVEFORM_DATA_WRITE, data, escaped=escaped)
|
||||||
|
|
||||||
def write_compliance_config_raw(self, data: bytes) -> None:
|
def write_compliance_config_raw(self, data: bytes, *, escaped: bool = True) -> None:
|
||||||
"""SUB 71: write the compliance image in addressed chunks, then confirm (72).
|
"""SUB 71: write the compliance image in addressed chunks, then confirm (72).
|
||||||
|
|
||||||
Measured: the image is 2,092 bytes (its header N = 2,090, plus 2), sent as
|
Measured: the image is 2,092 bytes (its header N = 2,090, plus 2), sent as
|
||||||
@@ -1115,7 +1185,7 @@ class MiniMateProtocol:
|
|||||||
both. (Retracted: "exactly 3 chunks, offset 0x1004, params 00 00 00 10 04"
|
both. (Retracted: "exactly 3 chunks, offset 0x1004, params 00 00 00 10 04"
|
||||||
-- the length 0x0400 and address 0x0400, read with their escape bytes.)
|
-- the length 0x0400 and address 0x0400, read with their escape bytes.)
|
||||||
"""
|
"""
|
||||||
image = write_image(SUB_COMPLIANCE_WRITE, data)
|
image = write_image(SUB_COMPLIANCE_WRITE, data, escaped=escaped)
|
||||||
rsp_sub = _expected_rsp_sub(SUB_COMPLIANCE_WRITE)
|
rsp_sub = _expected_rsp_sub(SUB_COMPLIANCE_WRITE)
|
||||||
for addr in range(0, len(image), _COMPLIANCE_CHUNK):
|
for addr in range(0, len(image), _COMPLIANCE_CHUNK):
|
||||||
params = bytes([0x00, 0x00, (addr >> 8) & 0xFF, addr & 0xFF]) + bytes(6)
|
params = bytes([0x00, 0x00, (addr >> 8) & 0xFF, addr & 0xFF]) + bytes(6)
|
||||||
@@ -1126,10 +1196,10 @@ class MiniMateProtocol:
|
|||||||
self.recv_write_ack(expected_sub=rsp_sub)
|
self.recv_write_ack(expected_sub=rsp_sub)
|
||||||
self.write_confirm(SUB_WRITE_CONFIRM_A)
|
self.write_confirm(SUB_WRITE_CONFIRM_A)
|
||||||
|
|
||||||
def write_trigger_config(self, data: bytes) -> S3Frame:
|
def write_trigger_config(self, data: bytes, *, escaped: bool = True) -> S3Frame:
|
||||||
"""SUB 82: write the trigger block (as SUB 0x2E read it). Ack 0x7D;
|
"""SUB 82: write the trigger block (as SUB 0x2E read it). Ack 0x7D;
|
||||||
callers follow with write_confirm(SUB_TRIGGER_CONFIRM). See write_image."""
|
callers follow with write_confirm(SUB_TRIGGER_CONFIRM). See write_image."""
|
||||||
return self._write_block(SUB_TRIGGER_CONFIG_WRITE, data)
|
return self._write_block(SUB_TRIGGER_CONFIG_WRITE, data, escaped=escaped)
|
||||||
|
|
||||||
def read_trigger_config(self) -> bytes:
|
def read_trigger_config(self) -> bytes:
|
||||||
"""SUB 0x2E two-step read: the 26-byte trigger block that SUB 82 writes.
|
"""SUB 0x2E two-step read: the 26-byte trigger block that SUB 82 writes.
|
||||||
|
|||||||
@@ -98,25 +98,25 @@ def _decode_delta_stream(buf: bytes) -> List[int]:
|
|||||||
|
|
||||||
|
|
||||||
def _find_chain(body: bytes):
|
def _find_chain(body: bytes):
|
||||||
"""Locate the four length-prefixed sensor-check records.
|
"""Locate the length-prefixed sensor-check records.
|
||||||
|
|
||||||
Returns a list of ``(offset, id, length)`` or ``None``. The chain is
|
Returns a list of ``(offset, id, length)`` or ``None``. The chain is
|
||||||
validated by walking the ids 0x3c → 0x3d → 0x3e → 0x3f via their own length
|
validated by walking the ids 0x3c → 0x3d → 0x3e (→ 0x3f) via their own
|
||||||
prefixes, so a stray 0x3c byte in the waveform data cannot match.
|
length prefixes, so a stray 0x3c byte in the waveform data cannot match.
|
||||||
|
A unit without a mic has no 0x3f (BE16352, all 8 of its DL2 events,
|
||||||
|
2026-11-06), so the three geophone records are enough.
|
||||||
"""
|
"""
|
||||||
for p in range(len(body) - 6):
|
for p in range(len(body) - 6):
|
||||||
if body[p + 2] == 0x3C and body[p + 3] == 0 and body[p + 4] == 0:
|
if body[p + 2] == 0x3C and body[p + 3] == 0 and body[p + 4] == 0:
|
||||||
q = p
|
q = p
|
||||||
recs = []
|
recs = []
|
||||||
ok = True
|
|
||||||
for expect in _CHAIN_IDS:
|
for expect in _CHAIN_IDS:
|
||||||
if q + 3 > len(body) or body[q + 2] != expect:
|
if q + 3 > len(body) or body[q + 2] != expect:
|
||||||
ok = False
|
|
||||||
break
|
break
|
||||||
length = int.from_bytes(body[q:q + 2], "big")
|
length = int.from_bytes(body[q:q + 2], "big")
|
||||||
recs.append((q, expect, length))
|
recs.append((q, expect, length))
|
||||||
q = q + 2 + length
|
q = q + 2 + length
|
||||||
if ok and len(recs) == 4:
|
if len(recs) >= 3:
|
||||||
return recs
|
return recs
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -124,8 +124,8 @@ def _find_chain(body: bytes):
|
|||||||
def decode_sensor_check(raw: bytes) -> Dict[str, List[int]]:
|
def decode_sensor_check(raw: bytes) -> Dict[str, List[int]]:
|
||||||
"""Decode the four sensor self-check traces from a series-3 event binary.
|
"""Decode the four sensor self-check traces from a series-3 event binary.
|
||||||
|
|
||||||
Returns ``{"Tran": [...], "Vert": [...], "Long": [...], "MicL": [...]}`` in
|
Returns ``{"Tran": [...], "Vert": [...], "Long": [...], "MicL": [...]}`` (no
|
||||||
raw decode units (same 16-count LSB as the main waveform), or ``{}`` if the
|
"MicL" on a unit without a mic) in raw decode units (same 16-count LSB as the main waveform), or ``{}`` if the
|
||||||
binary carries no sensor-check block (a histogram event, a non-series-3
|
binary carries no sensor-check block (a histogram event, a non-series-3
|
||||||
file, or a unit/firmware that doesn't store it).
|
file, or a unit/firmware that doesn't store it).
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -640,16 +640,21 @@ MIC_PA_PER_COUNT = 0.25
|
|||||||
# 124.2, and the 81.94 first fitted to a handful of values misses counts 119
|
# 124.2, and the 81.94 first fitted to a handful of values misses counts 119
|
||||||
# and 132. Its display chain presumably carries rounded constants; the
|
# and 132. Its display chain presumably carries rounded constants; the
|
||||||
# window, not the physics, is what is measured.
|
# window, not the physics, is what is measured.
|
||||||
_MIC_DB_REF = 81.9384
|
# ⚠ CORRECTED 2026-11-09: that window was too high. Every count Blastware
|
||||||
|
# printed in DL2 -- 1,704 in waveform sample tables, 520 in histogram
|
||||||
|
# intervals, 494 histogram peaks -- leaves [81.9382058, 81.9382266]: count
|
||||||
|
# 129 (124.2) bounds it from below, 463 (135.2, which 81.9384 prints 135.3)
|
||||||
|
# and 677 (138.5) from above. One offset serves all three.
|
||||||
|
_MIC_DB_REF = 81.938216
|
||||||
|
|
||||||
|
|
||||||
def mic_count_to_db(count: int) -> float:
|
def mic_count_to_db(count: int) -> float:
|
||||||
"""Convert a MicL ADC count to dB(L) for BW-display-compatible output.
|
"""Convert a MicL ADC count to dB(L) for BW-display-compatible output.
|
||||||
|
|
||||||
dB = sign(count) × (81.9384 + 20 × log10(|count|)) for |count| ≥ 1
|
dB = sign(count) × (81.938216 + 20 × log10(|count|)) for |count| ≥ 1
|
||||||
dB = 0.0 for count == 0
|
dB = 0.0 for count == 0
|
||||||
|
|
||||||
81.9384 ≈ 20 log10(0.25 Pa / 20 µPa); see _MIC_DB_REF.
|
81.938216 ≈ 20 log10(0.25 Pa / 20 µPa); see _MIC_DB_REF.
|
||||||
count=±1 → ±81.94 dB; count=813 → 140.14 dB (the V70 fixture).
|
count=±1 → ±81.94 dB; count=813 → 140.14 dB (the V70 fixture).
|
||||||
"""
|
"""
|
||||||
if count == 0:
|
if count == 0:
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
"""
|
|
||||||
poc_set_project.py — POC test for set_project_info() against a live MiniMate Plus.
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
python poc_set_project.py [--host IP] [--port PORT]
|
|
||||||
|
|
||||||
Default target: BE11529 at 63.43.212.232:9034
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import logging
|
|
||||||
import sys
|
|
||||||
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.DEBUG,
|
|
||||||
format="%(asctime)s %(levelname)-7s %(name)s %(message)s",
|
|
||||||
datefmt="%H:%M:%S",
|
|
||||||
)
|
|
||||||
log = logging.getLogger("poc_set_project")
|
|
||||||
|
|
||||||
from minimateplus import MiniMateClient
|
|
||||||
from minimateplus.transport import TcpTransport
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_HOST = "63.43.212.232"
|
|
||||||
DEFAULT_PORT = 9034
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
ap = argparse.ArgumentParser(description="POC: write project info to MiniMate Plus")
|
|
||||||
ap.add_argument("--host", default=DEFAULT_HOST, help="Modem IP address")
|
|
||||||
ap.add_argument("--port", type=int, default=DEFAULT_PORT, help="TCP port")
|
|
||||||
ap.add_argument("--project", default="POC Write Test")
|
|
||||||
ap.add_argument("--client-name", default="Terra-Mechanics Inc.")
|
|
||||||
ap.add_argument("--operator", default="B. Harrison")
|
|
||||||
ap.add_argument("--seis-loc", default="Lab Bench - POC")
|
|
||||||
ap.add_argument("--notes", default="set_project_info POC 2026-04-07")
|
|
||||||
args = ap.parse_args()
|
|
||||||
|
|
||||||
log.info("Connecting to %s:%d", args.host, args.port)
|
|
||||||
transport = TcpTransport(args.host, port=args.port)
|
|
||||||
|
|
||||||
with MiniMateClient(transport=transport, timeout=60.0) as client:
|
|
||||||
log.info("Performing POLL handshake + identity read …")
|
|
||||||
info = client.connect()
|
|
||||||
log.info("Connected: serial=%s firmware=%s", info.serial, info.firmware_version)
|
|
||||||
|
|
||||||
log.info("Calling set_project_info() …")
|
|
||||||
client.set_project_info(
|
|
||||||
project=args.project,
|
|
||||||
client_name=args.client_name,
|
|
||||||
operator=args.operator,
|
|
||||||
seis_loc=args.seis_loc,
|
|
||||||
notes=args.notes,
|
|
||||||
)
|
|
||||||
log.info("set_project_info() returned — write sequence complete")
|
|
||||||
|
|
||||||
log.info("Done. Reconnect Blastware to verify the fields were written.")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
try:
|
|
||||||
main()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
sys.exit(0)
|
|
||||||
except Exception as exc:
|
|
||||||
log.exception("Fatal: %s", exc)
|
|
||||||
sys.exit(1)
|
|
||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "seismo-relay"
|
name = "seismo-relay"
|
||||||
version = "0.33.0"
|
version = "0.35.0"
|
||||||
description = "Python client and REST server for MiniMate Plus seismographs"
|
description = "Python client and REST server for MiniMate Plus seismographs"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Cross-check .MLG records against Blastware event files, in both directions.
|
||||||
|
|
||||||
|
check_mlg_vs_events.py <mlg dir> <event dir>
|
||||||
|
|
||||||
|
Every .MLG record with the Event Recorded bit (not a "monitoring started" one)
|
||||||
|
should have an event file whose footer has the same stop time, flag word and
|
||||||
|
trigger source; and every event file inside a unit's .MLG period (its first
|
||||||
|
record's start to its last record's stop) should have such a record. The
|
||||||
|
footer is read straight from each event file's last 28 bytes, independently of
|
||||||
|
the event decoder, and its CRC-16/AUG-CCITT is checked on the way.
|
||||||
|
|
||||||
|
Spec docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md §7. Read-only.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import collections
|
||||||
|
import datetime
|
||||||
|
import os
|
||||||
|
import struct
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||||
|
|
||||||
|
from minimateplus.crc import crc16_aug_ccitt
|
||||||
|
from minimateplus.mlg_file import MlgFormatError, read_mlg
|
||||||
|
from sfm.waveform_store import _serial_number_from_bw_filename
|
||||||
|
|
||||||
|
_FOOTER_HEAD = b"\x00\x1a\x0e\x08"
|
||||||
|
|
||||||
|
|
||||||
|
def _ts_be(raw: bytes):
|
||||||
|
try:
|
||||||
|
return datetime.datetime(struct.unpack(">H", raw[2:4])[0], raw[1], raw[0], raw[5], raw[6], raw[7])
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _serial_number(serial: str):
|
||||||
|
digits = "".join(ch for ch in serial if ch.isdigit())
|
||||||
|
return int(digits) if digits else None
|
||||||
|
|
||||||
|
|
||||||
|
def mlg_side(mlg_dir: Path):
|
||||||
|
"""{unit number: (serial, [(stop, flags, source)], first start, last stop)}"""
|
||||||
|
units = {}
|
||||||
|
for path in sorted(p for p in mlg_dir.rglob("*") if p.is_file() and p.suffix.upper() == ".MLG"):
|
||||||
|
try:
|
||||||
|
mlg = read_mlg(path)
|
||||||
|
except MlgFormatError as exc:
|
||||||
|
print(f" skipped {path}: {exc}")
|
||||||
|
continue
|
||||||
|
if not mlg.serial or not mlg.records:
|
||||||
|
continue
|
||||||
|
n = _serial_number(mlg.serial)
|
||||||
|
serial, keys, lo, hi = units.get(n, (mlg.serial, [], None, None))
|
||||||
|
for r in mlg.records:
|
||||||
|
lo = min(lo, r.start) if lo else r.start
|
||||||
|
if r.stop:
|
||||||
|
hi = max(hi, r.stop) if hi else r.stop
|
||||||
|
if not r.is_start and r.flags & 0x0001:
|
||||||
|
keys.append((r.stop, r.flags, r.trigger_source))
|
||||||
|
units[n] = (serial, keys, lo, hi)
|
||||||
|
return units
|
||||||
|
|
||||||
|
|
||||||
|
def event_side(event_dir: Path, wanted: set):
|
||||||
|
"""{unit number: [(stop, flags, source, file name)]}, plus footer CRC failures."""
|
||||||
|
files = collections.defaultdict(list)
|
||||||
|
crc_bad = 0
|
||||||
|
for entry in os.scandir(event_dir):
|
||||||
|
if not entry.is_file():
|
||||||
|
continue
|
||||||
|
n = _serial_number_from_bw_filename(entry.name)
|
||||||
|
if n not in wanted:
|
||||||
|
continue
|
||||||
|
with open(entry.path, "rb") as f:
|
||||||
|
f.seek(0, 2)
|
||||||
|
if f.tell() < 28:
|
||||||
|
continue
|
||||||
|
f.seek(-28, 2)
|
||||||
|
tail = f.read(28)
|
||||||
|
if not tail.startswith(_FOOTER_HEAD):
|
||||||
|
continue
|
||||||
|
if crc16_aug_ccitt(tail[0:24]) != struct.unpack(">H", tail[26:28])[0]:
|
||||||
|
crc_bad += 1
|
||||||
|
flags, source = struct.unpack(">HH", tail[20:24])
|
||||||
|
files[n].append((_ts_be(tail[12:20]), flags, source, entry.name))
|
||||||
|
return files, crc_bad
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=None) -> int:
|
||||||
|
argv = argv if argv is not None else sys.argv[1:]
|
||||||
|
if len(argv) != 2:
|
||||||
|
print(__doc__)
|
||||||
|
return 2
|
||||||
|
units = mlg_side(Path(argv[0]))
|
||||||
|
files, crc_bad = event_side(Path(argv[1]), set(units))
|
||||||
|
checked = sum(len(v) for v in files.values())
|
||||||
|
print(f"event-file footers checked (units with .MLGs only): {checked}, failing their CRC: {crc_bad}")
|
||||||
|
for n, (serial, keys, lo, hi) in sorted(units.items(), key=lambda kv: kv[1][0]):
|
||||||
|
in_period = [f for f in files.get(n, []) if f[0] and lo <= f[0] <= hi]
|
||||||
|
file_keys = {f[:3] for f in in_period}
|
||||||
|
rec_keys = set(keys)
|
||||||
|
matched = [k for k in keys if k in file_keys]
|
||||||
|
record_only = [k for k in keys if k not in file_keys]
|
||||||
|
file_only = [f for f in in_period if f[:3] not in rec_keys]
|
||||||
|
print(f"\n{serial}: .MLG period {lo} -> {hi}")
|
||||||
|
print(f" matched {len(matched)}, record-only {len(record_only)}, file-only {len(file_only)}")
|
||||||
|
for k in record_only[:5]:
|
||||||
|
print(f" record-only: stop {k[0]} flags {k[1]:#06x} source {k[2]:#06x}")
|
||||||
|
if record_only:
|
||||||
|
print(f" record-only stops run {min(k[0] for k in record_only)} -> {max(k[0] for k in record_only)}")
|
||||||
|
for f in file_only[:5]:
|
||||||
|
print(f" file-only: {f[3]} stop {f[0]} flags {f[1]:#06x} source {f[2]:#06x}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Import every Blastware .MLG under a directory into SFM's DB and waveform store.
|
||||||
|
|
||||||
|
import_mlg_dir.py <dir> --db-path P --store-root S [--dry-run] [--not-call-in]
|
||||||
|
|
||||||
|
For a copy of an ACH folder (DL2 holds ~86,000). Idempotent: a file already
|
||||||
|
stored (same name, same bytes) counts as a duplicate. Files with records go
|
||||||
|
first, then the empty ones, so every unit's serial is known before its empty
|
||||||
|
files arrive whatever the folder order. Each file's modified time is stored
|
||||||
|
as its call-in time: copy with robocopy, not a Windows zip, whose dates read
|
||||||
|
an hour early from March to October.
|
||||||
|
|
||||||
|
Operational consequence: writes rows to mlg_files / mlg_records and copies each
|
||||||
|
original into <store>/<serial>/mlg/. The dry run writes nothing.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import datetime
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||||
|
|
||||||
|
from minimateplus.mlg_file import MLG_PREFIX, MlgFormatError, parse_mlg
|
||||||
|
from sfm.database import SeismoDb
|
||||||
|
from sfm.mlg_ingest import ingest_mlg
|
||||||
|
from sfm.waveform_store import WaveformStore
|
||||||
|
|
||||||
|
log = logging.getLogger("import_mlg_dir")
|
||||||
|
|
||||||
|
_COUNTS = ("files", "ok", "duplicate", "error", "empty", "unresolved", "inserted", "skipped")
|
||||||
|
|
||||||
|
|
||||||
|
def _mlg_files(root: Path) -> list[Path]:
|
||||||
|
"""Files with records first, then empty ones; each group oldest first."""
|
||||||
|
found = [p for p in root.rglob("*") if p.is_file() and p.suffix.upper() == ".MLG"]
|
||||||
|
key = lambda p: (p.stat().st_size <= len(MLG_PREFIX), p.stat().st_mtime, p.name)
|
||||||
|
return sorted(found, key=key)
|
||||||
|
|
||||||
|
|
||||||
|
def import_dir(root: Path, db_path: str, store_root: str, *, dry_run: bool = False,
|
||||||
|
call_in: bool = True) -> dict:
|
||||||
|
counts = dict.fromkeys(_COUNTS, 0)
|
||||||
|
db = store = None
|
||||||
|
if not dry_run:
|
||||||
|
db, store = SeismoDb(db_path), WaveformStore(store_root)
|
||||||
|
for path in _mlg_files(root):
|
||||||
|
counts["files"] += 1
|
||||||
|
data = path.read_bytes()
|
||||||
|
if dry_run:
|
||||||
|
try:
|
||||||
|
mlg = parse_mlg(data)
|
||||||
|
except MlgFormatError as exc:
|
||||||
|
counts["error"] += 1
|
||||||
|
log.warning("%s: %s", path, exc)
|
||||||
|
continue
|
||||||
|
counts["error" if mlg.crc_failures else "ok"] += 1
|
||||||
|
counts["empty"] += mlg.empty
|
||||||
|
continue
|
||||||
|
mtime = datetime.datetime.fromtimestamp(path.stat().st_mtime, datetime.timezone.utc)
|
||||||
|
res = ingest_mlg(db, store, path.name, data, file_mtime=mtime, call_in=call_in)
|
||||||
|
counts[res["status"]] += 1
|
||||||
|
if res["status"] == "error":
|
||||||
|
log.warning("%s: %s", path, res["detail"])
|
||||||
|
continue
|
||||||
|
counts["empty"] += res["empty"]
|
||||||
|
counts["unresolved"] += res["serial_unresolved"]
|
||||||
|
counts["inserted"] += res["inserted"]
|
||||||
|
counts["skipped"] += res["skipped"]
|
||||||
|
return counts
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=None) -> int:
|
||||||
|
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||||
|
ap.add_argument("dir")
|
||||||
|
ap.add_argument("--db-path", required=True)
|
||||||
|
ap.add_argument("--store-root", required=True)
|
||||||
|
ap.add_argument("--dry-run", action="store_true", help="parse and check only; write nothing")
|
||||||
|
ap.add_argument("--not-call-in", action="store_true",
|
||||||
|
help="these are cable / direct downloads, not call-ins")
|
||||||
|
a = ap.parse_args(argv)
|
||||||
|
logging.basicConfig(level=logging.WARNING)
|
||||||
|
counts = import_dir(Path(a.dir), a.db_path, a.store_root, dry_run=a.dry_run,
|
||||||
|
call_in=not a.not_call_in)
|
||||||
|
for key in _COUNTS:
|
||||||
|
print(f"{key} {counts[key]}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -73,7 +73,7 @@ def main(argv: list[str] | None = None) -> int:
|
|||||||
conn.row_factory = sqlite3.Row
|
conn.row_factory = sqlite3.Row
|
||||||
|
|
||||||
rows = list(conn.execute(
|
rows = list(conn.execute(
|
||||||
"SELECT id, serial, timestamp, blastware_filename "
|
"SELECT id, serial, timestamp, record_type, blastware_filename "
|
||||||
" FROM events "
|
" FROM events "
|
||||||
" WHERE serial = 'UNKNOWN' "
|
" WHERE serial = 'UNKNOWN' "
|
||||||
" ORDER BY timestamp",
|
" ORDER BY timestamp",
|
||||||
@@ -98,10 +98,11 @@ def main(argv: list[str] | None = None) -> int:
|
|||||||
unresolved += 1
|
unresolved += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Check for an existing row at the target (serial, timestamp).
|
# Check for an existing row at the target key (serial, timestamp,
|
||||||
|
# record_type -- #51).
|
||||||
existing = conn.execute(
|
existing = conn.execute(
|
||||||
"SELECT id FROM events WHERE serial = ? AND timestamp = ?",
|
"SELECT id FROM events WHERE serial = ? AND timestamp = ? AND record_type IS ?",
|
||||||
(new_serial, ts),
|
(new_serial, ts, row["record_type"]),
|
||||||
).fetchone()
|
).fetchone()
|
||||||
action: str
|
action: str
|
||||||
if existing is None:
|
if existing is None:
|
||||||
|
|||||||
+236
-25
@@ -1,11 +1,15 @@
|
|||||||
"""
|
"""
|
||||||
sfm/database.py — SQLite persistence layer for seismo-relay.
|
sfm/database.py — SQLite persistence layer for seismo-relay.
|
||||||
|
|
||||||
Three tables, all keyed by unit serial number:
|
Tables, all keyed by unit serial number:
|
||||||
|
|
||||||
ach_sessions — one row per inbound ACH call-home
|
ach_sessions — one row per inbound ACH call-home
|
||||||
events — one row per triggered waveform event (deduped by serial+timestamp)
|
events — one row per triggered waveform event (deduped by serial+timestamp)
|
||||||
monitor_log — one row per monitoring interval (deduped by serial+start_time)
|
monitor_log — one row per monitoring interval (deduped by serial+start_time);
|
||||||
|
live 0x0A reads by bridges/ach_server.py only
|
||||||
|
mlg_files — one row per Blastware .MLG received (deduped by file name+sha256)
|
||||||
|
mlg_records — one row per .MLG log record (deduped by serial, start, stop,
|
||||||
|
flag word, trigger source — never the text, which Blastware writes)
|
||||||
|
|
||||||
The DB file lives at:
|
The DB file lives at:
|
||||||
<output_dir>/seismo_relay.db (default: bridges/captures/seismo_relay.db)
|
<output_dir>/seismo_relay.db (default: bridges/captures/seismo_relay.db)
|
||||||
@@ -36,13 +40,14 @@ from __future__ import annotations
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import uuid
|
import uuid
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from minimateplus.blastware_file import blastware_filename_time
|
from minimateplus.blastware_file import blastware_filename_time
|
||||||
from minimateplus.models import Event, MonitorLogEntry
|
from minimateplus.models import Event, MlgRecord, MonitorLogEntry
|
||||||
|
|
||||||
log = logging.getLogger("sfm.database")
|
log = logging.getLogger("sfm.database")
|
||||||
|
|
||||||
@@ -107,7 +112,7 @@ CREATE TABLE IF NOT EXISTS events (
|
|||||||
shape_offset_pre REAL, -- pre-trigger baseline median (in/s)
|
shape_offset_pre REAL, -- pre-trigger baseline median (in/s)
|
||||||
shape_offset_spread REAL, -- max(pre,mid,end) - min(...) in in/s; small = constant/DC
|
shape_offset_spread REAL, -- max(pre,mid,end) - min(...) in in/s; small = constant/DC
|
||||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
||||||
UNIQUE(serial, timestamp)
|
UNIQUE(serial, timestamp, record_type) -- unit + time + type (#51); see Migration 3
|
||||||
);
|
);
|
||||||
CREATE INDEX IF NOT EXISTS idx_events_serial ON events(serial);
|
CREATE INDEX IF NOT EXISTS idx_events_serial ON events(serial);
|
||||||
CREATE INDEX IF NOT EXISTS idx_events_timestamp ON events(timestamp);
|
CREATE INDEX IF NOT EXISTS idx_events_timestamp ON events(timestamp);
|
||||||
@@ -149,6 +154,43 @@ CREATE TABLE IF NOT EXISTS device_commands (
|
|||||||
states TEXT -- JSON: {"before": ..., "seen": [...], "after": ...}
|
states TEXT -- JSON: {"before": ..., "seen": [...], "after": ...}
|
||||||
);
|
);
|
||||||
CREATE INDEX IF NOT EXISTS idx_device_commands_serial ON device_commands(serial, ts);
|
CREATE INDEX IF NOT EXISTS idx_device_commands_serial ON device_commands(serial, ts);
|
||||||
|
|
||||||
|
-- Blastware monitor logs (.MLG): spec docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md.
|
||||||
|
-- Record times are the unit's own local clock (naive ISO); file_mtime is UTC (+00:00).
|
||||||
|
CREATE TABLE IF NOT EXISTS mlg_files (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
serial TEXT, -- NULL: an empty file whose unit is not known yet
|
||||||
|
file_name TEXT NOT NULL,
|
||||||
|
sha256 TEXT NOT NULL,
|
||||||
|
size INTEGER NOT NULL,
|
||||||
|
record_count INTEGER NOT NULL, -- log records in the file (header excluded)
|
||||||
|
empty INTEGER NOT NULL, -- 1: the 18-byte prefix alone
|
||||||
|
call_in INTEGER NOT NULL DEFAULT 1, -- 0: a cable / direct download
|
||||||
|
file_mtime TEXT, -- the file's modified time, when the sender gave it
|
||||||
|
received_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%S+00:00', 'now')),
|
||||||
|
stored_path TEXT, -- the original file, relative to the waveform store
|
||||||
|
last_stop TEXT, -- the stop of the file's last record: the call that sent it
|
||||||
|
no_file_stops TEXT, -- JSON: earlier Modem Exit stops in it, calls that left no file
|
||||||
|
UNIQUE(file_name, sha256)
|
||||||
|
);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_mlg_files_serial ON mlg_files(serial);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS mlg_records (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
serial TEXT NOT NULL,
|
||||||
|
start_time TEXT NOT NULL,
|
||||||
|
stop_time TEXT, -- NULL: "monitoring started", no stop yet
|
||||||
|
flags INTEGER NOT NULL, -- monitor-log flag word; 65535 = started
|
||||||
|
trigger_source INTEGER NOT NULL, -- 1-8 a channel, 1024 a histogram, 0 none
|
||||||
|
text TEXT,
|
||||||
|
trigger_level TEXT,
|
||||||
|
event_time TEXT,
|
||||||
|
file_id TEXT NOT NULL REFERENCES mlg_files(id), -- the file it first came in
|
||||||
|
seq INTEGER NOT NULL -- its position in that file (1 = first log record)
|
||||||
|
);
|
||||||
|
-- NULL stops are distinct to a UNIQUE constraint, so the identity uses COALESCE.
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS ux_mlg_records_identity
|
||||||
|
ON mlg_records(serial, start_time, COALESCE(stop_time, ''), flags, trigger_source);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@@ -194,7 +236,7 @@ class SeismoDb:
|
|||||||
row = conn.execute(
|
row = conn.execute(
|
||||||
"SELECT sql FROM sqlite_master WHERE type='table' AND name='events'"
|
"SELECT sql FROM sqlite_master WHERE type='table' AND name='events'"
|
||||||
).fetchone()
|
).fetchone()
|
||||||
if row and "UNIQUE(serial, timestamp)" not in row[0]:
|
if row and "UNIQUE(serial, timestamp" not in row[0]: # neither key form yet
|
||||||
log.info("_migrate: rebuilding events table — UNIQUE(serial, timestamp)")
|
log.info("_migrate: rebuilding events table — UNIQUE(serial, timestamp)")
|
||||||
conn.executescript("""
|
conn.executescript("""
|
||||||
ALTER TABLE events RENAME TO events_old;
|
ALTER TABLE events RENAME TO events_old;
|
||||||
@@ -348,6 +390,33 @@ class SeismoDb:
|
|||||||
""")
|
""")
|
||||||
log.info("_migrate: monitor_log table rebuilt OK")
|
log.info("_migrate: monitor_log table rebuilt OK")
|
||||||
|
|
||||||
|
# Migration 3 (#51, 2026-11-03): events UNIQUE (serial, timestamp) ->
|
||||||
|
# (serial, timestamp, record_type). A unit records a waveform and a
|
||||||
|
# histogram in the same second legitimately -- 209 times in prod's
|
||||||
|
# 2026-09-30 store once histograms carry Blastware's start -- and the old
|
||||||
|
# key could hold only one. The table is rebuilt from its own current
|
||||||
|
# definition with only the key swapped, so every column added by the
|
||||||
|
# migrations above, every row and every id is kept (Terra-View reads
|
||||||
|
# rows by id); its indexes are recreated. One transaction.
|
||||||
|
row = conn.execute(
|
||||||
|
"SELECT sql FROM sqlite_master WHERE type='table' AND name='events'"
|
||||||
|
).fetchone()
|
||||||
|
if row and "UNIQUE(serial, timestamp)" in row[0]:
|
||||||
|
log.info("_migrate: rebuilding events table — UNIQUE(serial, timestamp, record_type)")
|
||||||
|
indexes = [r[0] for r in conn.execute(
|
||||||
|
"SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name='events' "
|
||||||
|
"AND sql IS NOT NULL")]
|
||||||
|
table = re.sub(r'^CREATE TABLE\s+("?)events\1', "CREATE TABLE events_rekeyed",
|
||||||
|
row[0].replace("UNIQUE(serial, timestamp)",
|
||||||
|
"UNIQUE(serial, timestamp, record_type)", 1))
|
||||||
|
conn.executescript("BEGIN;\n" + table + ";\n"
|
||||||
|
"INSERT INTO events_rekeyed SELECT * FROM events;\n"
|
||||||
|
"DROP TABLE events;\n"
|
||||||
|
"ALTER TABLE events_rekeyed RENAME TO events;\n"
|
||||||
|
+ "".join(sql + ";\n" for sql in indexes)
|
||||||
|
+ "COMMIT;")
|
||||||
|
log.info("_migrate: events table re-keyed OK (%d indexes recreated)", len(indexes))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _iso(dt: Optional[datetime.datetime]) -> Optional[str]:
|
def _iso(dt: Optional[datetime.datetime]) -> Optional[str]:
|
||||||
return dt.isoformat() if dt is not None else None
|
return dt.isoformat() if dt is not None else None
|
||||||
@@ -507,7 +576,8 @@ class SeismoDb:
|
|||||||
device_family: Optional[str] = None,
|
device_family: Optional[str] = None,
|
||||||
) -> tuple[int, int]:
|
) -> tuple[int, int]:
|
||||||
"""
|
"""
|
||||||
Insert triggered events. Silently skips duplicates (serial+timestamp).
|
Insert triggered events. Silently skips duplicates (serial + timestamp +
|
||||||
|
record_type: a waveform and a histogram may share a second, #51).
|
||||||
Returns (inserted, skipped).
|
Returns (inserted, skipped).
|
||||||
|
|
||||||
``waveform_records`` (optional): dict keyed by event waveform_key (hex)
|
``waveform_records`` (optional): dict keyed by event waveform_key (hex)
|
||||||
@@ -515,7 +585,7 @@ class SeismoDb:
|
|||||||
{"filename": str, "filesize": int, "a5_pickle_filename": str}
|
{"filename": str, "filesize": int, "a5_pickle_filename": str}
|
||||||
|
|
||||||
For events whose key is in this dict, the matching columns are
|
For events whose key is in this dict, the matching columns are
|
||||||
populated. If a row with the same (serial, timestamp) already exists
|
populated. If a row with the same (serial, timestamp, record_type) already exists
|
||||||
(dedup hit), the matching waveform record is upserted onto the
|
(dedup hit), the matching waveform record is upserted onto the
|
||||||
existing row so a re-download via the live endpoint refreshes the
|
existing row so a re-download via the live endpoint refreshes the
|
||||||
file metadata.
|
file metadata.
|
||||||
@@ -558,18 +628,27 @@ class SeismoDb:
|
|||||||
# No validated event record: the time may be a second off,
|
# No validated event record: the time may be a second off,
|
||||||
# so it is never allowed to move, merge into or duplicate
|
# so it is never allowed to move, merge into or duplicate
|
||||||
# a row (_estimate_guard). The file is already stored.
|
# a row (_estimate_guard). The file is already stored.
|
||||||
why = self._estimate_guard(conn, serial, rec.get("filename"), ts)
|
why = self._estimate_guard(conn, serial, rec.get("filename"), ts,
|
||||||
|
ev.record_type)
|
||||||
if why:
|
if why:
|
||||||
log.warning("insert_events: %s %s: %s", serial,
|
log.warning("insert_events: %s %s: %s", serial,
|
||||||
rec.get("filename") or key, why)
|
rec.get("filename") or key, why)
|
||||||
skipped += 1
|
skipped += 1
|
||||||
continue
|
continue
|
||||||
elif rec.get("filename") and ts and \
|
elif rec.get("filename") and ts and \
|
||||||
self._restamp_by_file(conn, serial, rec["filename"], ts) is False:
|
self._restamp_by_file(conn, serial, rec["filename"], ts,
|
||||||
|
ev.record_type) is False:
|
||||||
skipped += 1
|
skipped += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if ev.record_type is None and conn.execute(
|
||||||
|
"SELECT 1 FROM events WHERE serial = ? AND timestamp = ? "
|
||||||
|
"AND record_type IS NULL", (serial, ts)).fetchone():
|
||||||
|
# A UNIQUE key treats NULLs as distinct, so an untyped
|
||||||
|
# event would never collide: it still refreshes the
|
||||||
|
# untyped row at its second, as under the old key.
|
||||||
|
raise sqlite3.IntegrityError("untyped event already stored")
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"""
|
"""
|
||||||
INSERT INTO events
|
INSERT INTO events
|
||||||
@@ -629,7 +708,7 @@ class SeismoDb:
|
|||||||
inserted += 1
|
inserted += 1
|
||||||
except sqlite3.IntegrityError:
|
except sqlite3.IntegrityError:
|
||||||
skipped += 1
|
skipped += 1
|
||||||
# UPSERT path: a row for this (serial, timestamp) already
|
# UPSERT path: a row for this (serial, timestamp, record_type) already
|
||||||
# exists. Refresh every device-authoritative field from
|
# exists. Refresh every device-authoritative field from
|
||||||
# the new data so that a re-import with better data (e.g.
|
# the new data so that a re-import with better data (e.g.
|
||||||
# a watcher re-forward where the previous attempt missed
|
# a watcher re-forward where the previous attempt missed
|
||||||
@@ -682,7 +761,7 @@ class SeismoDb:
|
|||||||
shape_offset_axis = COALESCE(?, shape_offset_axis),
|
shape_offset_axis = COALESCE(?, shape_offset_axis),
|
||||||
shape_offset_pre = COALESCE(?, shape_offset_pre),
|
shape_offset_pre = COALESCE(?, shape_offset_pre),
|
||||||
shape_offset_spread = COALESCE(?, shape_offset_spread)
|
shape_offset_spread = COALESCE(?, shape_offset_spread)
|
||||||
WHERE serial = ? AND timestamp = ?
|
WHERE serial = ? AND timestamp = ? AND record_type IS ?
|
||||||
""",
|
""",
|
||||||
(
|
(
|
||||||
pv.tran if pv else None,
|
pv.tran if pv else None,
|
||||||
@@ -719,6 +798,7 @@ class SeismoDb:
|
|||||||
rec.get("shape_offset_spread") if rec else None,
|
rec.get("shape_offset_spread") if rec else None,
|
||||||
serial,
|
serial,
|
||||||
ts,
|
ts,
|
||||||
|
ev.record_type,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -728,11 +808,11 @@ class SeismoDb:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _estimate_guard(conn: sqlite3.Connection, serial: str, filename: Optional[str],
|
def _estimate_guard(conn: sqlite3.Connection, serial: str, filename: Optional[str],
|
||||||
ts: Optional[str]) -> Optional[str]:
|
ts: Optional[str], record_type: Optional[str] = None) -> Optional[str]:
|
||||||
"""Why an event whose time is only an estimate must not be written, or None.
|
"""Why an event whose time is only an estimate must not be written, or None.
|
||||||
|
|
||||||
An estimate (the decoder found no validated event record) may be a
|
An estimate (the decoder found no validated event record) may be a
|
||||||
second off, and (serial, timestamp) is the table's key. So it never
|
second off, and (serial, timestamp, record_type) is the table's key. So it never
|
||||||
moves a row, never lands on another event's row, and never adds a second
|
moves a row, never lands on another event's row, and never adds a second
|
||||||
row for an event already stored -- each refusal is logged by the caller,
|
row for an event already stored -- each refusal is logged by the caller,
|
||||||
and the event's file and sidecar are already in the store. Its own
|
and the event's file and sidecar are already in the store. Its own
|
||||||
@@ -747,8 +827,8 @@ class SeismoDb:
|
|||||||
return (f"already stored under {', '.join(str(t) for t in own)}; its estimated "
|
return (f"already stored under {', '.join(str(t) for t in own)}; its estimated "
|
||||||
f"time {ts} does not move or duplicate it")
|
f"time {ts} does not move or duplicate it")
|
||||||
holder = conn.execute(
|
holder = conn.execute(
|
||||||
"SELECT blastware_filename FROM events WHERE serial = ? AND timestamp = ?",
|
"SELECT blastware_filename FROM events WHERE serial = ? AND timestamp = ? "
|
||||||
(serial, ts)).fetchone()
|
"AND record_type IS ?", (serial, ts, record_type)).fetchone()
|
||||||
if holder is not None and (named is None or holder[0] != named):
|
if holder is not None and (named is None or holder[0] != named):
|
||||||
return (f"its estimated time {ts} is held by {holder[0] or 'another event'}; "
|
return (f"its estimated time {ts} is held by {holder[0] or 'another event'}; "
|
||||||
"not merged into it")
|
"not merged into it")
|
||||||
@@ -756,8 +836,9 @@ class SeismoDb:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _restamp_by_file(conn: sqlite3.Connection, serial: str, filename: str,
|
def _restamp_by_file(conn: sqlite3.Connection, serial: str, filename: str,
|
||||||
ts: str) -> Optional[bool]:
|
ts: str, record_type: Optional[str] = None) -> Optional[bool]:
|
||||||
"""Move this file's row to `ts` when it sits under another time.
|
"""Move this file's row to `ts` (and `record_type`) when it sits under
|
||||||
|
another time or type.
|
||||||
|
|
||||||
The events table is unique on (serial, timestamp), so an event re-stored
|
The events table is unique on (serial, timestamp), so an event re-stored
|
||||||
with a corrected time -- every Series-3 waveform after the event-time fix,
|
with a corrected time -- every Series-3 waveform after the event-time fix,
|
||||||
@@ -768,6 +849,10 @@ class SeismoDb:
|
|||||||
stored as "imported.bw" -- so only a Blastware name is matched. Of
|
stored as "imported.bw" -- so only a Blastware name is matched. Of
|
||||||
several rows for one file, a reviewed one with a time moves first.
|
several rows for one file, a reviewed one with a time moves first.
|
||||||
|
|
||||||
|
The type moves the same way: before v0.33.0 a row's type came from the
|
||||||
|
filename, and with the type in the key (#51) a re-import under the file's
|
||||||
|
own type would otherwise add a second row.
|
||||||
|
|
||||||
Returns True when the row was moved; None when there was nothing to move
|
Returns True when the row was moved; None when there was nothing to move
|
||||||
(no row for this file elsewhere, or this file's own row already holds
|
(no row for this file elsewhere, or this file's own row already holds
|
||||||
`ts`), so the caller goes on as before; False when a different stored
|
`ts`), so the caller goes on as before; False when a different stored
|
||||||
@@ -778,18 +863,20 @@ class SeismoDb:
|
|||||||
return None
|
return None
|
||||||
mine = conn.execute(
|
mine = conn.execute(
|
||||||
"SELECT id, timestamp FROM events WHERE serial = ? AND blastware_filename = ? "
|
"SELECT id, timestamp FROM events WHERE serial = ? AND blastware_filename = ? "
|
||||||
"AND (timestamp IS NULL OR timestamp != ?) "
|
"AND (timestamp IS NULL OR timestamp != ? OR record_type IS NOT ?) "
|
||||||
"ORDER BY COALESCE(false_trigger, 0) DESC, timestamp IS NULL, rowid LIMIT 1",
|
"ORDER BY COALESCE(false_trigger, 0) DESC, timestamp IS NULL, rowid LIMIT 1",
|
||||||
(serial, filename, ts),
|
(serial, filename, ts, record_type),
|
||||||
).fetchone()
|
).fetchone()
|
||||||
if mine is None:
|
if mine is None:
|
||||||
return None
|
return None
|
||||||
holder = conn.execute(
|
holder = conn.execute(
|
||||||
"SELECT id, blastware_filename FROM events WHERE serial = ? AND timestamp = ?",
|
"SELECT id, blastware_filename FROM events WHERE serial = ? AND timestamp = ? "
|
||||||
(serial, ts),
|
"AND record_type IS ?",
|
||||||
|
(serial, ts, record_type),
|
||||||
).fetchone()
|
).fetchone()
|
||||||
if holder is None:
|
if holder is None:
|
||||||
conn.execute("UPDATE events SET timestamp = ? WHERE id = ?", (ts, mine[0]))
|
conn.execute("UPDATE events SET timestamp = ?, record_type = ? WHERE id = ?",
|
||||||
|
(ts, record_type, mine[0]))
|
||||||
log.info("insert_events: %s %s moved from %s to %s (corrected event time)",
|
log.info("insert_events: %s %s moved from %s to %s (corrected event time)",
|
||||||
serial, filename, mine[1], ts)
|
serial, filename, mine[1], ts)
|
||||||
return True
|
return True
|
||||||
@@ -808,7 +895,8 @@ class SeismoDb:
|
|||||||
).fetchone()
|
).fetchone()
|
||||||
return dict(row) if row else None
|
return dict(row) if row else None
|
||||||
|
|
||||||
def find_event_by_blastware_name(self, serial: str, filename: str) -> Optional[dict]:
|
def find_event_by_blastware_name(self, serial: str, filename: str,
|
||||||
|
record_type: Optional[str] = None) -> Optional[dict]:
|
||||||
"""The row stored under `filename`'s Blastware name, or None.
|
"""The row stored under `filename`'s Blastware name, or None.
|
||||||
|
|
||||||
A Blastware name encodes the serial and the event's second
|
A Blastware name encodes the serial and the event's second
|
||||||
@@ -819,6 +907,10 @@ class SeismoDb:
|
|||||||
itself and the letterless form -- not the other letter, since in
|
itself and the letterless form -- not the other letter, since in
|
||||||
Histogram+Continuous a waveform can trigger in the second a histogram
|
Histogram+Continuous a waveform can trigger in the second a histogram
|
||||||
starts. Any other name ("imported.bw") matches nothing.
|
starts. Any other name ("imported.bw") matches nothing.
|
||||||
|
|
||||||
|
`record_type`: only a row of that type -- or an untyped one, which may be
|
||||||
|
this event -- matches (#51: a same-second waveform / histogram twin shares
|
||||||
|
the letterless name). Compared ignoring case.
|
||||||
"""
|
"""
|
||||||
if blastware_filename_time(filename) is None:
|
if blastware_filename_time(filename) is None:
|
||||||
return None
|
return None
|
||||||
@@ -828,10 +920,14 @@ class SeismoDb:
|
|||||||
else:
|
else:
|
||||||
forms = (name, name + "W", name + "H")
|
forms = (name, name + "W", name + "H")
|
||||||
with self._connect() as conn:
|
with self._connect() as conn:
|
||||||
|
typed, args = "", (serial, *forms)
|
||||||
|
if record_type is not None:
|
||||||
|
typed = " AND (record_type IS NULL OR UPPER(record_type) = UPPER(?))"
|
||||||
|
args = (*args, record_type)
|
||||||
row = conn.execute(
|
row = conn.execute(
|
||||||
f"SELECT * FROM events WHERE serial = ? AND UPPER(blastware_filename) IN "
|
f"SELECT * FROM events WHERE serial = ? AND UPPER(blastware_filename) IN "
|
||||||
f"({', '.join('?' * len(forms))}) ORDER BY rowid LIMIT 1",
|
f"({', '.join('?' * len(forms))}){typed} ORDER BY rowid LIMIT 1",
|
||||||
(serial, *forms),
|
args,
|
||||||
).fetchone()
|
).fetchone()
|
||||||
return dict(row) if row else None
|
return dict(row) if row else None
|
||||||
|
|
||||||
@@ -1204,6 +1300,121 @@ class SeismoDb:
|
|||||||
).fetchall()
|
).fetchall()
|
||||||
return [dict(r) for r in rows]
|
return [dict(r) for r in rows]
|
||||||
|
|
||||||
|
# ── Blastware monitor logs (.MLG) ─────────────────────────────────────────
|
||||||
|
|
||||||
|
def mlg_file_exists(self, file_name: str, sha256: str) -> bool:
|
||||||
|
with self._connect() as conn:
|
||||||
|
row = conn.execute(
|
||||||
|
"SELECT 1 FROM mlg_files WHERE file_name = ? AND sha256 = ?",
|
||||||
|
(file_name, sha256),
|
||||||
|
).fetchone()
|
||||||
|
return row is not None
|
||||||
|
|
||||||
|
def insert_mlg(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
serial: Optional[str],
|
||||||
|
file_name: str,
|
||||||
|
sha256: str,
|
||||||
|
size: int,
|
||||||
|
empty: bool,
|
||||||
|
call_in: bool,
|
||||||
|
file_mtime: Optional[datetime.datetime],
|
||||||
|
stored_path: Optional[str],
|
||||||
|
records: list[MlgRecord],
|
||||||
|
last_stop: Optional[datetime.datetime] = None,
|
||||||
|
no_file_stops: Optional[list[datetime.datetime]] = None,
|
||||||
|
) -> tuple[Optional[str], int, int]:
|
||||||
|
"""Store one .MLG file and its log records, in one transaction.
|
||||||
|
|
||||||
|
Returns (file_id, inserted, skipped); (None, 0, 0) when this file name
|
||||||
|
with these bytes is already stored. A record already stored (from an
|
||||||
|
earlier file) is skipped and keeps pointing at that file; the file's own
|
||||||
|
call summary (last_stop, no_file_stops) is kept on its row either way."""
|
||||||
|
file_id = self._new_id()
|
||||||
|
inserted = skipped = 0
|
||||||
|
no_file_json = json.dumps([self._iso(t) for t in (no_file_stops or [])])
|
||||||
|
with self._connect() as conn:
|
||||||
|
try:
|
||||||
|
conn.execute(
|
||||||
|
"""
|
||||||
|
INSERT INTO mlg_files
|
||||||
|
(id, serial, file_name, sha256, size, record_count, empty,
|
||||||
|
call_in, file_mtime, stored_path, last_stop, no_file_stops)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
""",
|
||||||
|
(file_id, serial, file_name, sha256, size, len(records), int(empty),
|
||||||
|
int(call_in), self._iso(file_mtime), stored_path, self._iso(last_stop),
|
||||||
|
no_file_json),
|
||||||
|
)
|
||||||
|
except sqlite3.IntegrityError:
|
||||||
|
return None, 0, 0
|
||||||
|
for r in records:
|
||||||
|
cur = conn.execute(
|
||||||
|
"""
|
||||||
|
INSERT OR IGNORE INTO mlg_records
|
||||||
|
(id, serial, start_time, stop_time, flags, trigger_source,
|
||||||
|
text, trigger_level, event_time, file_id, seq)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
""",
|
||||||
|
(self._new_id(), serial, self._iso(r.start), self._iso(r.stop), r.flags,
|
||||||
|
r.trigger_source, r.text, r.trigger_level, self._iso(r.event_time),
|
||||||
|
file_id, r.index),
|
||||||
|
)
|
||||||
|
if cur.rowcount:
|
||||||
|
inserted += 1
|
||||||
|
else:
|
||||||
|
skipped += 1
|
||||||
|
log.debug("insert_mlg %s inserted=%d skipped=%d", file_name, inserted, skipped)
|
||||||
|
return file_id, inserted, skipped
|
||||||
|
|
||||||
|
def query_mlg_records(
|
||||||
|
self,
|
||||||
|
serial: str,
|
||||||
|
from_dt: Optional[datetime.datetime] = None,
|
||||||
|
to_dt: Optional[datetime.datetime] = None,
|
||||||
|
) -> list[dict]:
|
||||||
|
"""A unit's .MLG records, oldest first (start time, then position in file)."""
|
||||||
|
clauses, params = ["serial = ?"], [serial]
|
||||||
|
if from_dt:
|
||||||
|
clauses.append("start_time >= ?")
|
||||||
|
params.append(from_dt.isoformat())
|
||||||
|
if to_dt:
|
||||||
|
clauses.append("start_time <= ?")
|
||||||
|
params.append(to_dt.isoformat())
|
||||||
|
with self._connect() as conn:
|
||||||
|
rows = conn.execute(
|
||||||
|
f"SELECT * FROM mlg_records WHERE {' AND '.join(clauses)} "
|
||||||
|
f"ORDER BY start_time, seq",
|
||||||
|
params,
|
||||||
|
).fetchall()
|
||||||
|
return [dict(r) for r in rows]
|
||||||
|
|
||||||
|
def query_mlg_files(self, serial: str) -> list[dict]:
|
||||||
|
"""A unit's received .MLG files, oldest file time first."""
|
||||||
|
with self._connect() as conn:
|
||||||
|
rows = conn.execute(
|
||||||
|
"SELECT * FROM mlg_files WHERE serial = ? "
|
||||||
|
"ORDER BY COALESCE(file_mtime, received_at), file_name",
|
||||||
|
(serial,),
|
||||||
|
).fetchall()
|
||||||
|
return [dict(r) for r in rows]
|
||||||
|
|
||||||
|
def get_mlg_file(self, file_id: str) -> Optional[dict]:
|
||||||
|
with self._connect() as conn:
|
||||||
|
row = conn.execute("SELECT * FROM mlg_files WHERE id = ?", (file_id,)).fetchone()
|
||||||
|
return dict(row) if row else None
|
||||||
|
|
||||||
|
def known_serials(self) -> set[str]:
|
||||||
|
"""Every serial SFM holds data for: events, .MLG files and records."""
|
||||||
|
with self._connect() as conn:
|
||||||
|
rows = conn.execute(
|
||||||
|
"SELECT serial FROM events WHERE serial IS NOT NULL "
|
||||||
|
"UNION SELECT serial FROM mlg_files WHERE serial IS NOT NULL "
|
||||||
|
"UNION SELECT serial FROM mlg_records"
|
||||||
|
).fetchall()
|
||||||
|
return {r["serial"] for r in rows if r["serial"]}
|
||||||
|
|
||||||
# ── Fleet overview ────────────────────────────────────────────────────────
|
# ── Fleet overview ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
def query_units(self) -> list[dict]:
|
def query_units(self) -> list[dict]:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import threading
|
|||||||
import time
|
import time
|
||||||
from typing import Any, Callable, Dict, Optional
|
from typing import Any, Callable, Dict, Optional
|
||||||
|
|
||||||
from .errors import ConnectFailed, DeviceError, NoAnswer, NotSupported, WrongUnit
|
from .errors import BadRequest, ConnectFailed, DeviceError, NoAnswer, NotSupported, WrongUnit
|
||||||
from .events import parse_event_id
|
from .events import parse_event_id
|
||||||
from .locks import UnitLocks
|
from .locks import UnitLocks
|
||||||
from .models import (CallHomeState, ChangeResult, DownloadedEvent, EventList, UnitAddress, UnitInfo,
|
from .models import (CallHomeState, ChangeResult, DownloadedEvent, EventList, UnitAddress, UnitInfo,
|
||||||
@@ -17,6 +17,7 @@ from .models import (CallHomeState, ChangeResult, DownloadedEvent, EventList, Un
|
|||||||
from .s3 import Series3Adapter, default_s3_client_factory
|
from .s3 import Series3Adapter, default_s3_client_factory
|
||||||
from .s4 import (
|
from .s4 import (
|
||||||
Series4Session, default_s4_client_factory, s4_call_home_state, s4_change_call_home, s4_change_monitoring,
|
Series4Session, default_s4_client_factory, s4_call_home_state, s4_change_call_home, s4_change_monitoring,
|
||||||
|
s4_change_settings,
|
||||||
s4_download_event, s4_identify, s4_list_events, s4_settings, s4_status,
|
s4_download_event, s4_identify, s4_list_events, s4_settings, s4_status,
|
||||||
)
|
)
|
||||||
from .series import normalise_serial, series_for_serial
|
from .series import normalise_serial, series_for_serial
|
||||||
@@ -27,6 +28,9 @@ log = logging.getLogger("sfm.device_access")
|
|||||||
# reads, a second apart -- not the start/stop window.
|
# reads, a second apart -- not the start/stop window.
|
||||||
_CALL_HOME_VERIFY_TIMEOUT_S = 3.0
|
_CALL_HOME_VERIFY_TIMEOUT_S = 3.0
|
||||||
_CALL_HOME_VERIFY_INTERVAL_S = 1.0
|
_CALL_HOME_VERIFY_INTERVAL_S = 1.0
|
||||||
|
# A settings read-back is one block read (seconds over cellular): two tries, a second apart.
|
||||||
|
_SETTINGS_VERIFY_TIMEOUT_S = 2.0
|
||||||
|
_SETTINGS_VERIFY_INTERVAL_S = 1.0
|
||||||
|
|
||||||
|
|
||||||
class DeviceAccess:
|
class DeviceAccess:
|
||||||
@@ -140,6 +144,34 @@ class DeviceAccess:
|
|||||||
lambda c, s: s4_change_call_home(c, s, address=address, **kw),
|
lambda c, s: s4_change_call_home(c, s, address=address, **kw),
|
||||||
change=True)
|
change=True)
|
||||||
|
|
||||||
|
def change_settings(self, address: UnitAddress, serial: str, *, changes: dict,
|
||||||
|
revision: Optional[str], dry_run: bool = False,
|
||||||
|
caller: str = "api") -> ChangeResult:
|
||||||
|
"""Change the unit's settings (spec row 10, phase 5). A dry run is the
|
||||||
|
preview: old -> new per field and a `revision`. A live change needs that
|
||||||
|
revision; it is audited, identity-checked, sent once, never retried, and
|
||||||
|
read back. Refused before any I/O: no changes, a live call without a
|
||||||
|
revision, no audit log."""
|
||||||
|
serial = normalise_serial(serial)
|
||||||
|
series_for_serial(serial) # BadRequest (422) before anything else
|
||||||
|
if not isinstance(changes, dict) or not changes:
|
||||||
|
raise BadRequest("no settings to change -- nothing sent")
|
||||||
|
if not dry_run and not revision:
|
||||||
|
raise BadRequest("preview first: a live change needs the revision from its preview "
|
||||||
|
"-- nothing sent")
|
||||||
|
if not dry_run and self._audit is None:
|
||||||
|
raise NotSupported("no audit log is configured -- SFM refuses to change a unit "
|
||||||
|
"without one (nothing sent)")
|
||||||
|
kw = dict(changes=changes, revision=revision, dry_run=dry_run, audit=self._audit,
|
||||||
|
caller=caller, sleep=self._sleep,
|
||||||
|
verify_timeout_s=_SETTINGS_VERIFY_TIMEOUT_S,
|
||||||
|
verify_interval_s=_SETTINGS_VERIFY_INTERVAL_S)
|
||||||
|
return self._dispatch(
|
||||||
|
address, serial,
|
||||||
|
lambda a, s: self._s3.change_settings(a, s, **kw),
|
||||||
|
lambda c, s: s4_change_settings(c, s, address=address, **kw),
|
||||||
|
change=True)
|
||||||
|
|
||||||
def held_serial(self, address: UnitAddress) -> Optional[str]:
|
def held_serial(self, address: UnitAddress) -> Optional[str]:
|
||||||
"""Serial of the OPEN held Series-4 line at this address, else None. No I/O."""
|
"""Serial of the OPEN held Series-4 line at this address, else None. No I/O."""
|
||||||
with self._sessions_guard:
|
with self._sessions_guard:
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ def call_home_change(enabled: bool) -> ChangeKind:
|
|||||||
else ChangeKind("disable call-home", "disabled", "disabled"))
|
else ChangeKind("disable call-home", "disabled", "disabled"))
|
||||||
|
|
||||||
|
|
||||||
|
def settings_change() -> ChangeKind:
|
||||||
|
"""A settings change (phase 5): its "state" is a read-back verdict --
|
||||||
|
"as asked" (the unit holds what was written), "unchanged", or "differs"."""
|
||||||
|
return ChangeKind("change settings", "as asked", "applied")
|
||||||
|
|
||||||
|
|
||||||
def _take_snapshot(snapshot: Optional[Callable[[], Dict[str, Any]]]) -> Optional[Dict[str, Any]]:
|
def _take_snapshot(snapshot: Optional[Callable[[], Dict[str, Any]]]) -> Optional[Dict[str, Any]]:
|
||||||
"""The caller's record of what the unit holds after the change -- for the
|
"""The caller's record of what the unit holds after the change -- for the
|
||||||
result and the audit row only. It never decides the outcome."""
|
result and the audit row only. It never decides the outcome."""
|
||||||
|
|||||||
@@ -88,6 +88,18 @@ class EventNotFound(DeviceError):
|
|||||||
http_status = 404
|
http_status = 404
|
||||||
|
|
||||||
|
|
||||||
|
class SettingsChanged(DeviceError):
|
||||||
|
"""The unit's settings changed since the preview the request names (a keypad
|
||||||
|
edit, another program, or a preview of another unit). Nothing was sent."""
|
||||||
|
http_status = 409
|
||||||
|
|
||||||
|
|
||||||
|
class ChangeRefused(DeviceError):
|
||||||
|
"""A change SFM will not send to this unit, and why -- its factory setup, a
|
||||||
|
schedule that would undo it, a block SFM has not seen. Nothing was sent."""
|
||||||
|
http_status = 409
|
||||||
|
|
||||||
|
|
||||||
class StaleEvent(DeviceError):
|
class StaleEvent(DeviceError):
|
||||||
"""The event at that key is not the one listed -- the unit was erased, or
|
"""The event at that key is not the one listed -- the unit was erased, or
|
||||||
its memory wrapped, since the list was read."""
|
its memory wrapped, since the list was read."""
|
||||||
|
|||||||
+141
-22
@@ -11,15 +11,23 @@ from minimateplus import MiniMateClient
|
|||||||
from minimateplus.blastware_file import blastware_file_bytes, blastware_filename, with_type_letter
|
from minimateplus.blastware_file import blastware_file_bytes, blastware_filename, with_type_letter
|
||||||
from minimateplus.event_file_io import _GEO_INT16_FS
|
from minimateplus.event_file_io import _GEO_INT16_FS
|
||||||
from minimateplus.framing import build_bw_write_frame, unescape_reply
|
from minimateplus.framing import build_bw_write_frame, unescape_reply
|
||||||
|
from micromate.setup_block import decode_setup
|
||||||
|
from micromate.setup_fields import (
|
||||||
|
SettingsValueError, changes_bytes, check_changes, editable_fields, encode_setup, field_rows,
|
||||||
|
field_values, settings_state,
|
||||||
|
)
|
||||||
|
from micromate.setup_fields import revision as settings_revision
|
||||||
from minimateplus.protocol import (
|
from minimateplus.protocol import (
|
||||||
SUB_CALL_HOME_CONFIRM, SUB_CALL_HOME_WRITE, SUB_START_MONITORING, SUB_STOP_MONITORING,
|
SUB_CALL_HOME_CONFIRM, SUB_CALL_HOME_WRITE, SUB_COMPLIANCE_WRITE, SUB_EVENT_INDEX_WRITE,
|
||||||
ImageRefused, call_home_enabled, call_home_image, is_call_home_block, write_image,
|
SUB_START_MONITORING, SUB_STOP_MONITORING, SUB_TRIGGER_CONFIG_WRITE, SUB_WAVEFORM_DATA_WRITE,
|
||||||
|
ImageRefused, call_home_enabled, call_home_image, is_call_home_block, is_compliance_content,
|
||||||
|
write_image,
|
||||||
)
|
)
|
||||||
from minimateplus.transport import TcpTransport
|
from minimateplus.transport import TcpTransport
|
||||||
|
|
||||||
from .errors import (DeviceError, EventNotFound, MalformedReply, NoAnswer, NotSupported, StaleEvent,
|
from .errors import (BadRequest, ChangeRefused, DeviceError, EventNotFound, MalformedReply, NoAnswer, NotSupported,
|
||||||
UnitStateUnknown, WrongUnit, translate)
|
SettingsChanged, StaleEvent, UnitStateUnknown, WrongUnit, translate)
|
||||||
from .change import call_home_change, monitoring_change, run_change
|
from .change import call_home_change, monitoring_change, run_change, settings_change
|
||||||
from .events import iso_of, make_event_id, stamp_of
|
from .events import iso_of, make_event_id, stamp_of
|
||||||
from .models import (CallHomeState, ChangeResult, DownloadedEvent, EventList, EventRef, UnitAddress,
|
from .models import (CallHomeState, ChangeResult, DownloadedEvent, EventList, EventRef, UnitAddress,
|
||||||
UnitInfo, UnitSettings, UnitStatus)
|
UnitInfo, UnitSettings, UnitStatus)
|
||||||
@@ -49,6 +57,25 @@ S3_CALL_HOME_WHILE_MONITORING = ("did not return its call-home settings -- a Min
|
|||||||
# The 0x1C flag byte (section[1]): the only values ever measured. 0x10 is
|
# The 0x1C flag byte (section[1]): the only values ever measured. 0x10 is
|
||||||
# BE11529 monitoring (2026-04-08); 0x0B is BE9441 recording a histogram,
|
# BE11529 monitoring (2026-04-08); 0x0B is BE9441 recording a histogram,
|
||||||
# confirmed at the unit (2026-10-26). Anything else is refused for a change.
|
# confirmed at the unit (2026-10-26). Anything else is refused for a change.
|
||||||
|
# Measured 2026-11-03 (BE9441's 10-26 recording, 5 / 5 reads): while monitoring, a
|
||||||
|
# MiniMate answers the 1A settings read with its device-info block.
|
||||||
|
S3_SETTINGS_WHILE_MONITORING = ("did not return its settings -- a MiniMate answers this way "
|
||||||
|
"while monitoring; stop monitoring first (a stop makes it call in "
|
||||||
|
"if call-home is on)")
|
||||||
|
# Blastware's settings write, in its order (push_config_raw): event index, the
|
||||||
|
# settings block in addressed chunks, trigger, waveform data, with their confirms.
|
||||||
|
_S3_SETTINGS_STEPS = ((0x68, "event index (as read)"), (0x73, "confirm B"),
|
||||||
|
(0x71, "settings block"), (0x72, "confirm A"),
|
||||||
|
(0x82, "trigger block (as read)"), (0x83, "trigger confirm"),
|
||||||
|
(0x69, "waveform data (as read)"), (0x74, "confirm C"), (0x72, "confirm A"))
|
||||||
|
_S3_TAIL_WARNING = ("the two bytes after the settings block go out as 00 00 (Blastware sends "
|
||||||
|
"its own constant; the unit took it at the bench 2026-11-04)")
|
||||||
|
# Measured at the bench 2026-11-04 (BE9441): a write sent while the setup menu was open
|
||||||
|
# was acknowledged and read back, then lost when the operator pressed Cancel or Save --
|
||||||
|
# the menu writes its own copy of the whole block back.
|
||||||
|
_S3_MENU_WARNING = ("if someone is in this unit's setup menu, this change is lost when they "
|
||||||
|
"leave it (Cancel or Save writes the menu's copy back)")
|
||||||
|
|
||||||
S3_RUN_STATES = {0x00: "idle", 0x10: "monitoring", 0x0B: "monitoring"}
|
S3_RUN_STATES = {0x00: "idle", 0x10: "monitoring", 0x0B: "monitoring"}
|
||||||
|
|
||||||
|
|
||||||
@@ -435,29 +462,121 @@ class Series3Adapter:
|
|||||||
is_refusal=lambda e: isinstance(e, ImageRefused))
|
is_refusal=lambda e: isinstance(e, ImageRefused))
|
||||||
return self._run(address, op, retry=False)
|
return self._run(address, op, retry=False)
|
||||||
|
|
||||||
|
def change_settings(self, address: UnitAddress, serial: str, *, changes: dict,
|
||||||
|
revision: Optional[str], dry_run: bool, audit: Any, caller: str,
|
||||||
|
sleep: Callable[[float], None], verify_timeout_s: float,
|
||||||
|
verify_interval_s: float) -> ChangeResult:
|
||||||
|
"""Series-3 pieces for the shared core (phase 5): read the four settings
|
||||||
|
blocks, patch the settings block's fields (micromate.setup_fields), send
|
||||||
|
Blastware's sequence through push_config_raw with the other three blocks
|
||||||
|
as read, re-read the settings. One attempt, never retried.
|
||||||
|
|
||||||
|
Refused before anything is sent: a monitoring unit (it answers 1A with its
|
||||||
|
device-info block); a value the unit does not allow (BadRequest); a live
|
||||||
|
call whose `revision` is not this read's (SettingsChanged)."""
|
||||||
|
def op(client: Any) -> ChangeResult:
|
||||||
|
st: dict = {}
|
||||||
|
reads: list = []
|
||||||
|
|
||||||
|
def read_serial() -> str:
|
||||||
|
return client.connect().serial or "" # a fresh connection: the 0x15 read
|
||||||
|
|
||||||
|
def read_state() -> str:
|
||||||
|
client.wake(attempt_s=S3_WAKE_ATTEMPT_S, deadline_s=S3_WAKE_DEADLINE_S)
|
||||||
|
if st:
|
||||||
|
now = client.read_compliance_content()
|
||||||
|
if not is_compliance_content(now):
|
||||||
|
raise MalformedReply("the read-back did not return the settings block")
|
||||||
|
reads.append(now)
|
||||||
|
return settings_state(st["setup"], st["image"], now, series=3)
|
||||||
|
blocks = client.read_settings_blocks()
|
||||||
|
setup = blocks["compliance"]
|
||||||
|
if not is_compliance_content(setup):
|
||||||
|
raise UnitStateUnknown(f"{serial} {S3_SETTINGS_WHILE_MONITORING} -- nothing sent")
|
||||||
|
try:
|
||||||
|
normal = check_changes(setup, 3, changes)
|
||||||
|
except SettingsValueError as exc:
|
||||||
|
raise BadRequest(f"{exc} -- nothing sent") from exc
|
||||||
|
# What the preview showed: the settings block and the changes. The other
|
||||||
|
# three blocks are re-read here and sent back as read (the trigger block's
|
||||||
|
# byte 5 "differs by unit and session", #46).
|
||||||
|
rev = settings_revision([setup, changes_bytes(normal)])
|
||||||
|
if not dry_run and revision != rev:
|
||||||
|
raise SettingsChanged(f"{serial}'s settings, or the changes asked for, are not "
|
||||||
|
"the ones previewed -- preview again; nothing sent")
|
||||||
|
image = encode_setup(setup, 3, normal)
|
||||||
|
blocked = []
|
||||||
|
for sub, block in ((SUB_EVENT_INDEX_WRITE, blocks["event_index"]),
|
||||||
|
(SUB_COMPLIANCE_WRITE, image),
|
||||||
|
(SUB_TRIGGER_CONFIG_WRITE, blocks["trigger"]),
|
||||||
|
(SUB_WAVEFORM_DATA_WRITE, blocks["waveform"])):
|
||||||
|
try:
|
||||||
|
write_image(sub, block, escaped=False) # push_config_raw's own check
|
||||||
|
except ValueError as exc:
|
||||||
|
blocked.append(f"this unit's {exc} -- SFM has not seen a block like it")
|
||||||
|
st.update(blocks=blocks, setup=setup, image=image, changes=normal, revision=rev,
|
||||||
|
blocked=blocked)
|
||||||
|
reads.append(setup)
|
||||||
|
return settings_state(setup, image, setup, series=3)
|
||||||
|
|
||||||
|
def describe_plan() -> dict:
|
||||||
|
b = st["blocks"]
|
||||||
|
lens = {0x68: len(b["event_index"]), 0x71: len(st["image"]) + 2,
|
||||||
|
0x82: len(b["trigger"]), 0x69: len(b["waveform"])}
|
||||||
|
if st["blocked"] and not dry_run:
|
||||||
|
raise ChangeRefused("; ".join(st["blocked"]) + " -- nothing sent")
|
||||||
|
steps = [] if st["blocked"] else [
|
||||||
|
{"sub": f"0x{sub:02X}", "what": what, "data_len": lens.get(sub, 0)}
|
||||||
|
for sub, what in _S3_SETTINGS_STEPS]
|
||||||
|
return {"action": "settings write", "blocked": list(st["blocked"]), "steps": steps,
|
||||||
|
"fields": field_rows(st["setup"], st["image"], 3, st["changes"]),
|
||||||
|
"revision": st["revision"], "warnings": [_S3_MENU_WARNING, _S3_TAIL_WARNING]}
|
||||||
|
|
||||||
|
def send() -> dict:
|
||||||
|
b = st["blocks"]
|
||||||
|
client.push_config_raw(b["event_index"], st["image"], b["trigger"], b["waveform"],
|
||||||
|
escaped=False) # every block read is logical
|
||||||
|
return {"subs": [f"0x{0xFF - sub:02X}" for sub, _ in _S3_SETTINGS_STEPS]}
|
||||||
|
|
||||||
|
def snapshot() -> dict:
|
||||||
|
before, after = st["setup"], reads[-1]
|
||||||
|
return {"fields": field_rows(before, st["image"], 3, st["changes"], now=after),
|
||||||
|
"before": before.hex(), "after": after.hex(),
|
||||||
|
"changed_offsets": [i for i in range(min(len(before), len(after)))
|
||||||
|
if before[i] != after[i]]}
|
||||||
|
|
||||||
|
return run_change(
|
||||||
|
kind=settings_change(), serial=serial, series=3, dry_run=dry_run,
|
||||||
|
even_if_already=False, audit=audit, address=address, caller=caller, sleep=sleep,
|
||||||
|
verify_timeout_s=verify_timeout_s, verify_interval_s=verify_interval_s,
|
||||||
|
read_serial=read_serial, read_state=read_state, describe_plan=describe_plan,
|
||||||
|
send=send, snapshot=snapshot,
|
||||||
|
# raised before the first frame goes out: audited as nothing sent
|
||||||
|
is_refusal=lambda e: isinstance(e, ImageRefused))
|
||||||
|
return self._run(address, op, retry=False)
|
||||||
|
|
||||||
def settings(self, address: UnitAddress, serial: str) -> UnitSettings:
|
def settings(self, address: UnitAddress, serial: str) -> UnitSettings:
|
||||||
|
"""The 1A read assembled into the logical block and decoded by the shared
|
||||||
|
settings codec (phase 5)."""
|
||||||
def op(client: Any) -> UnitSettings:
|
def op(client: Any) -> UnitSettings:
|
||||||
info = client.connect()
|
info = client.connect()
|
||||||
self._check(info.serial, serial, address)
|
self._check(info.serial, serial, address)
|
||||||
cc = info.compliance_config
|
content = client.read_compliance_content()
|
||||||
if cc is None:
|
if not is_compliance_content(content):
|
||||||
raise MalformedReply("could not read the unit's settings (SUB 0x1A)")
|
raise UnitStateUnknown(f"{serial} {S3_SETTINGS_WHILE_MONITORING}")
|
||||||
mode = None
|
v = field_values(content, 3)
|
||||||
if cc.recording_mode is not None:
|
name = decode_setup(content + bytes(2), verify=False).name # Series 3 reads no CRC
|
||||||
mode = S3_MODES.get(cc.recording_mode, f"unknown (0x{cc.recording_mode:02x})")
|
labels = {d["field"]: d["label"] for d in editable_fields(content, 3)}
|
||||||
notes = {
|
notes = {labels[f]: v[f] for f in ("note_1", "note_2", "note_3", "note_4")}
|
||||||
label: value for label, value in (
|
code = content[5]
|
||||||
("Project", cc.project), ("Client", cc.client), ("User Name", cc.operator),
|
|
||||||
("Seis Loc", cc.sensor_location), ("Extended Notes", cc.notes),
|
|
||||||
) if value is not None
|
|
||||||
}
|
|
||||||
return UnitSettings(
|
return UnitSettings(
|
||||||
serial=info.serial, series=3, setup_name=cc.setup_name, record_mode=mode,
|
serial=info.serial, series=3, setup_name=name or None,
|
||||||
sample_rate=cc.sample_rate, record_time_s=cc.record_time,
|
record_mode=S3_MODES.get(code, f"unknown (0x{code:02x})"),
|
||||||
histogram_interval_s=cc.histogram_interval_sec, geo_trigger_ips=cc.trigger_level_geo,
|
sample_rate=v["sample_rate"], record_time_s=v["record_time_s"],
|
||||||
|
histogram_interval_s=v["histogram_interval_s"], geo_trigger_ips=v["geo_trigger_ips"],
|
||||||
notes=notes,
|
notes=notes,
|
||||||
detail={"record_mode_code": cc.recording_mode, "alarm_level_geo": cc.alarm_level_geo,
|
detail={"record_mode_code": code, "alarm_level_geo": v["geo_alarm_ips"],
|
||||||
"geo_range": cc.geo_range},
|
"geo_range": v["geo_range"], "editable": editable_fields(content, 3)},
|
||||||
)
|
)
|
||||||
return self._run(address, op)
|
return self._run(address, op)
|
||||||
|
|
||||||
|
|||||||
+136
-5
@@ -19,16 +19,28 @@ from typing import Any, Callable, Optional, TypeVar
|
|||||||
from micromate.client import MicromateClient
|
from micromate.client import MicromateClient
|
||||||
from micromate.opcodes import OpcodeRefused
|
from micromate.opcodes import OpcodeRefused
|
||||||
from micromate.protocol import THOR_CHUNK_SIZE
|
from micromate.protocol import THOR_CHUNK_SIZE
|
||||||
|
from micromate.protocol import ProtocolError as _MMProtocolError
|
||||||
|
from micromate.schedule import parse_schedule, schedule_conflicts
|
||||||
|
from micromate.setup_block import decode_setup
|
||||||
|
from micromate.setup_fields import (
|
||||||
|
SettingsValueError, changes_bytes, check_changes, editable_fields, encode_setup, field_rows,
|
||||||
|
settings_state,
|
||||||
|
)
|
||||||
|
from micromate.setup_fields import revision as settings_revision
|
||||||
from micromate.writes import (
|
from micromate.writes import (
|
||||||
is_call_home_content, plan_call_home_enabled, plan_start_monitoring, plan_stop_monitoring,
|
is_call_home_content, plan_call_home_enabled, plan_setup_push, plan_start_monitoring,
|
||||||
|
plan_stop_monitoring,
|
||||||
)
|
)
|
||||||
from minimateplus.transport import BaseTransport, SerialTransport, TcpTransport
|
from minimateplus.transport import BaseTransport, SerialTransport, TcpTransport
|
||||||
|
|
||||||
from .errors import (
|
from .errors import (
|
||||||
AuditIncomplete, CallHomeInProgress, ChangeUnconfirmed, DeviceError, EventNotFound,
|
AuditIncomplete, BadRequest, CallHomeInProgress, ChangeRefused, ChangeUnconfirmed, DeviceError,
|
||||||
MalformedReply, StaleEvent, UnitStateUnknown, WrongUnit, translate,
|
EventNotFound, MalformedReply, SettingsChanged, StaleEvent, UnitStateUnknown, WrongUnit,
|
||||||
|
translate,
|
||||||
|
)
|
||||||
|
from .change import (
|
||||||
|
CALL_HOME_MESSAGE, call_home_change, monitoring_change, run_change, settings_change,
|
||||||
)
|
)
|
||||||
from .change import CALL_HOME_MESSAGE, call_home_change, monitoring_change, run_change
|
|
||||||
from .events import iso_of, make_event_id, stamp_of
|
from .events import iso_of, make_event_id, stamp_of
|
||||||
from .models import (CallHomeState, ChangeResult, DownloadedEvent, EventList, EventRef, UnitAddress,
|
from .models import (CallHomeState, ChangeResult, DownloadedEvent, EventList, EventRef, UnitAddress,
|
||||||
UnitInfo, UnitSettings, UnitStatus)
|
UnitInfo, UnitSettings, UnitStatus)
|
||||||
@@ -268,7 +280,8 @@ def s4_status(client: Any, serial: str, run_state: bool = False) -> UnitStatus:
|
|||||||
|
|
||||||
|
|
||||||
def s4_settings(client: Any, serial: str) -> UnitSettings:
|
def s4_settings(client: Any, serial: str) -> UnitSettings:
|
||||||
s = client.get_setup()
|
content = client.get_setup_content()
|
||||||
|
s = decode_setup(content)
|
||||||
return UnitSettings(
|
return UnitSettings(
|
||||||
serial=serial, series=4, setup_name=s.name, record_mode=s.record_mode_name,
|
serial=serial, series=4, setup_name=s.name, record_mode=s.record_mode_name,
|
||||||
sample_rate=s.sample_rate, record_time_s=s.record_time_s,
|
sample_rate=s.sample_rate, record_time_s=s.record_time_s,
|
||||||
@@ -293,6 +306,7 @@ def s4_settings(client: Any, serial: str) -> UnitSettings:
|
|||||||
"distance_ft": s.distance_ft,
|
"distance_ft": s.distance_ft,
|
||||||
"charge_weight_lb": s.charge_weight_lb,
|
"charge_weight_lb": s.charge_weight_lb,
|
||||||
"scaled_distance": s.scaled_distance,
|
"scaled_distance": s.scaled_distance,
|
||||||
|
"editable": editable_fields(content, 4),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -452,3 +466,120 @@ def s4_change_call_home(client: Any, serial: str, *, enabled: bool, dry_run: boo
|
|||||||
is_ring=lambda e: isinstance(e, RingDetected),
|
is_ring=lambda e: isinstance(e, RingDetected),
|
||||||
pre_send=lambda: client.read_unsolicited(),
|
pre_send=lambda: client.read_unsolicited(),
|
||||||
snapshot=snapshot)
|
snapshot=snapshot)
|
||||||
|
|
||||||
|
|
||||||
|
# ── Changing settings (phase 5) ──────────────────────────────────────────────
|
||||||
|
|
||||||
|
S4_SETTINGS_WHILE_MONITORING = ("is monitoring -- stop it first (a stop makes it call in if "
|
||||||
|
"call-home is on)")
|
||||||
|
_EDIT_BUFFER_WARNING = ("this reads the unit's keypad edit buffer: if someone is in its menu, "
|
||||||
|
"their unsaved edits are sent too")
|
||||||
|
_FACTORY = "factory.mmb"
|
||||||
|
|
||||||
|
|
||||||
|
def s4_change_settings(client: Any, serial: str, *, changes: dict, revision: Optional[str],
|
||||||
|
dry_run: bool, audit: Any, address: UnitAddress, caller: str,
|
||||||
|
sleep: Callable[[float], None], verify_timeout_s: float,
|
||||||
|
verify_interval_s: float) -> ChangeResult:
|
||||||
|
"""Series-4 pieces for the shared core: read the name, preferences, trigger
|
||||||
|
and setup blocks and the schedule; patch the setup's fields
|
||||||
|
(micromate.setup_fields); send THOR's setup push under the active setup's own
|
||||||
|
name; read the setup back. The plan is built from the read run_change made
|
||||||
|
just before it, and that same plan is the one sent.
|
||||||
|
|
||||||
|
Refused before anything is sent: a monitoring unit; values the unit does not
|
||||||
|
allow (BadRequest); a live call whose `revision` is not this read's
|
||||||
|
(SettingsChanged); the factory setup, a schedule that would load another
|
||||||
|
setup, an unreadable schedule, or a block SFM has not seen (ChangeRefused,
|
||||||
|
shown as `blocked` in a preview)."""
|
||||||
|
st: dict = {}
|
||||||
|
reads: list = []
|
||||||
|
|
||||||
|
def first_read() -> str:
|
||||||
|
name = client.get_active_setup_raw()
|
||||||
|
prefs = client.get_prefs_content()
|
||||||
|
trigger = client.get_trigger_content()
|
||||||
|
setup = client.get_setup_content()
|
||||||
|
try:
|
||||||
|
normal = check_changes(setup, 4, changes)
|
||||||
|
except SettingsValueError as exc:
|
||||||
|
raise BadRequest(f"{exc} -- nothing sent") from exc
|
||||||
|
# What the preview showed: the target name, the setup block, the changes. The
|
||||||
|
# preferences and trigger blocks are re-read here and sent back as read.
|
||||||
|
rev = settings_revision([name.encode("ascii", "replace"), setup, changes_bytes(normal)])
|
||||||
|
if not dry_run and revision != rev:
|
||||||
|
raise SettingsChanged(f"{serial}'s settings, or the changes asked for, are not the ones "
|
||||||
|
"previewed -- preview again; nothing sent")
|
||||||
|
image = encode_setup(setup, 4, normal)
|
||||||
|
blocked: list = []
|
||||||
|
warnings = [_EDIT_BUFFER_WARNING]
|
||||||
|
if name.strip().casefold() == _FACTORY:
|
||||||
|
blocked.append("this unit is running its factory setup; load any other setup on "
|
||||||
|
"its keypad, then try again")
|
||||||
|
try:
|
||||||
|
entries = parse_schedule(client.read_schedule())
|
||||||
|
except (_MMProtocolError, ValueError) as exc:
|
||||||
|
blocked.append(f"could not read this unit's schedule ({exc}) -- SFM will not change "
|
||||||
|
"a unit whose schedule it cannot check")
|
||||||
|
else:
|
||||||
|
conflicts = schedule_conflicts(entries, name)
|
||||||
|
for e in conflicts:
|
||||||
|
blocked.append(f"this unit's schedule loads {e.setup} at {e.time}, which would "
|
||||||
|
"replace this change")
|
||||||
|
for e in entries:
|
||||||
|
if "start_with_setup" in e.actions and e not in conflicts:
|
||||||
|
warnings.append(f"the unit's schedule loads this setup at {e.time}; the "
|
||||||
|
"change survives it")
|
||||||
|
plan = None
|
||||||
|
try:
|
||||||
|
plan = plan_setup_push(prefs, trigger, image, name)
|
||||||
|
except ValueError as exc:
|
||||||
|
blocked.append(f"this unit's {exc} -- SFM has not seen a block like it")
|
||||||
|
st.update(name=name, prefs=prefs, trigger=trigger, setup=setup, image=image,
|
||||||
|
changes=normal, revision=rev, blocked=blocked, warnings=warnings, plan=plan)
|
||||||
|
reads.append(setup)
|
||||||
|
return settings_state(setup, image, setup, series=4)
|
||||||
|
|
||||||
|
def read_state() -> str:
|
||||||
|
run = client.read_run_state().name
|
||||||
|
if run == "calling_home" or run.startswith("unknown"):
|
||||||
|
return run # the core refuses both; a write waits for a known state
|
||||||
|
if not st:
|
||||||
|
if run == "monitoring":
|
||||||
|
raise UnitStateUnknown(f"{serial} {S4_SETTINGS_WHILE_MONITORING} -- nothing sent")
|
||||||
|
return first_read()
|
||||||
|
now = client.get_setup_content()
|
||||||
|
reads.append(now)
|
||||||
|
return settings_state(st["setup"], st["image"], now, series=4)
|
||||||
|
|
||||||
|
def describe_plan() -> dict:
|
||||||
|
ok = st["plan"] is not None and not st["blocked"]
|
||||||
|
d = st["plan"].describe() if ok else {"action": "setup push", "steps": [], "warnings": []}
|
||||||
|
d["warnings"] = list(st["warnings"]) + list(d.get("warnings", []))
|
||||||
|
d.update(fields=field_rows(st["setup"], st["image"], 4, st["changes"]),
|
||||||
|
revision=st["revision"], blocked=list(st["blocked"]))
|
||||||
|
if st["blocked"] and not dry_run:
|
||||||
|
raise ChangeRefused("; ".join(st["blocked"]) + " -- nothing sent")
|
||||||
|
return d
|
||||||
|
|
||||||
|
def send() -> dict:
|
||||||
|
acks = client.protocol.execute(st["plan"])
|
||||||
|
return {"subs": [f"0x{a.sub:02X}" for a in acks], "data": [bytes(a.data).hex() for a in acks]}
|
||||||
|
|
||||||
|
def snapshot() -> dict:
|
||||||
|
before, after = st["setup"], reads[-1]
|
||||||
|
return {"fields": field_rows(before, st["image"], 4, st["changes"], now=after),
|
||||||
|
"before": before.hex(), "after": after.hex(),
|
||||||
|
"changed_offsets": _changed_offsets(before, after),
|
||||||
|
"prefs": st["prefs"].hex(), "trigger": st["trigger"].hex()}
|
||||||
|
|
||||||
|
return run_change(
|
||||||
|
kind=settings_change(), serial=serial, series=4, dry_run=dry_run, even_if_already=False,
|
||||||
|
audit=audit, address=address, caller=caller, sleep=sleep,
|
||||||
|
verify_timeout_s=verify_timeout_s, verify_interval_s=verify_interval_s,
|
||||||
|
read_serial=lambda: client.serial(refresh=True),
|
||||||
|
read_state=read_state, describe_plan=describe_plan, send=send,
|
||||||
|
is_refusal=lambda e: isinstance(e, OpcodeRefused),
|
||||||
|
is_ring=lambda e: isinstance(e, RingDetected),
|
||||||
|
pre_send=lambda: client.read_unsolicited(),
|
||||||
|
snapshot=snapshot)
|
||||||
@@ -34,6 +34,14 @@ Layout written to `<filename>.h5`:
|
|||||||
sensor_location str
|
sensor_location str
|
||||||
job_number int (only when read; kept while not shown)
|
job_number int (only when read; kept while not shown)
|
||||||
job_number_enabled bool (Blastware prints the job number)
|
job_number_enabled bool (Blastware prints the job number)
|
||||||
|
battery_volts, triggered_by, trigger_sources, trigger_level_geo_ips,
|
||||||
|
trigger_level_mic_psi, firmware_version, dsp_version, model,
|
||||||
|
calibration_date (ISO), calibrated_by
|
||||||
|
(each only when read from the event file)
|
||||||
|
histogram_interval_sec int (histograms)
|
||||||
|
/intervals (histograms, when read)
|
||||||
|
half_period/<ch> uint16 samples per interval; Hz = (sample rate / 2) / it
|
||||||
|
pvs_ips float32 each interval's vector sum, in/s
|
||||||
peak_tran_ips float (from 0C; authoritative)
|
peak_tran_ips float (from 0C; authoritative)
|
||||||
peak_vert_ips float
|
peak_vert_ips float
|
||||||
peak_long_ips float
|
peak_long_ips float
|
||||||
@@ -262,6 +270,24 @@ def write_event_hdf5(
|
|||||||
if pi is not None and getattr(pi, "job_number", None) is not None:
|
if pi is not None and getattr(pi, "job_number", None) is not None:
|
||||||
attrs["job_number"] = int(pi.job_number)
|
attrs["job_number"] = int(pi.job_number)
|
||||||
attrs["job_number_enabled"] = bool(pi.job_number_enabled)
|
attrs["job_number_enabled"] = bool(pi.job_number_enabled)
|
||||||
|
# Read from a Blastware file's identity and setup blocks; absent when not read.
|
||||||
|
for attr, value in (
|
||||||
|
("battery_volts", getattr(event, "battery_volts", None)),
|
||||||
|
("triggered_by", getattr(event, "triggered_by", None)),
|
||||||
|
("trigger_sources", getattr(event, "trigger_sources", None)),
|
||||||
|
("trigger_level_geo_ips", getattr(event, "trigger_level_geo", None)),
|
||||||
|
("trigger_level_mic_psi", getattr(event, "trigger_level_mic_psi", None)),
|
||||||
|
("histogram_interval_sec", getattr(event, "histogram_interval_sec", None)),
|
||||||
|
):
|
||||||
|
if value is not None:
|
||||||
|
attrs[attr] = value
|
||||||
|
di = getattr(event, "device_info", None)
|
||||||
|
if di is not None:
|
||||||
|
for attr in ("firmware_version", "dsp_version", "model", "calibrated_by"):
|
||||||
|
if getattr(di, attr, None):
|
||||||
|
attrs[attr] = getattr(di, attr)
|
||||||
|
if getattr(di, "calibration_date", None) is not None:
|
||||||
|
attrs["calibration_date"] = di.calibration_date.isoformat()
|
||||||
attrs["peak_tran_ips"] = float(pv.tran if pv and pv.tran is not None else 0.0)
|
attrs["peak_tran_ips"] = float(pv.tran if pv and pv.tran is not None else 0.0)
|
||||||
attrs["peak_vert_ips"] = float(pv.vert if pv and pv.vert is not None else 0.0)
|
attrs["peak_vert_ips"] = float(pv.vert if pv and pv.vert is not None else 0.0)
|
||||||
attrs["peak_long_ips"] = float(pv.long if pv and pv.long is not None else 0.0)
|
attrs["peak_long_ips"] = float(pv.long if pv and pv.long is not None else 0.0)
|
||||||
@@ -283,6 +309,22 @@ def write_event_hdf5(
|
|||||||
compression="gzip", compression_opts=4, shuffle=True,
|
compression="gzip", compression_opts=4, shuffle=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# /intervals — a histogram's per-interval detail as the file holds it:
|
||||||
|
# each channel's half-period in samples (frequency = (sample rate / 2)
|
||||||
|
# / half-period; 0 is Blastware's "N/A") and each interval's vector sum.
|
||||||
|
half_periods = getattr(event, "interval_half_periods", None)
|
||||||
|
interval_pvs = getattr(event, "interval_pvs", None)
|
||||||
|
if half_periods or interval_pvs:
|
||||||
|
igrp_iv = f.create_group("intervals")
|
||||||
|
if half_periods:
|
||||||
|
hgrp = igrp_iv.create_group("half_period")
|
||||||
|
for ch, hps in half_periods.items():
|
||||||
|
hgrp.create_dataset(ch, data=np.asarray(hps, dtype="uint16"),
|
||||||
|
compression="gzip", compression_opts=4, shuffle=True)
|
||||||
|
if interval_pvs:
|
||||||
|
igrp_iv.create_dataset("pvs_ips", data=np.asarray(interval_pvs, dtype="float32"),
|
||||||
|
compression="gzip", compression_opts=4, shuffle=True)
|
||||||
|
|
||||||
# /samples_int16 — optional raw ADC counts (preserved for analysis
|
# /samples_int16 — optional raw ADC counts (preserved for analysis
|
||||||
# tools that want pre-conversion data). Cheap to include.
|
# tools that want pre-conversion data). Cheap to include.
|
||||||
if include_int16:
|
if include_int16:
|
||||||
|
|||||||
+33
-6
@@ -134,16 +134,43 @@ def _overlay_s4_record(ev: Any, record: dict) -> None:
|
|||||||
ev.project_info.sensor_location = location
|
ev.project_info.sensor_location = location
|
||||||
|
|
||||||
|
|
||||||
|
def _download_record_type(dl: DownloadedEvent) -> Optional[str]:
|
||||||
|
"""The download's own record type -- "Waveform" / "Histogram", as every stored
|
||||||
|
row has it -- from its file: a Series-3 file's STRT[18], a Series-4 name's
|
||||||
|
IDFW / IDFH. None when it does not read (then any row at its second counts)."""
|
||||||
|
if dl.series == 4:
|
||||||
|
ext = dl.filename.rsplit(".", 1)[-1].upper()
|
||||||
|
return {"IDFW": "Waveform", "IDFH": "Histogram"}.get(ext)
|
||||||
|
if not dl.bw_bytes:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
from minimateplus.event_file_io import decode_blastware_bytes
|
||||||
|
return decode_blastware_bytes(dl.bw_bytes).record_type
|
||||||
|
except Exception: # noqa: BLE001 -- a check, not a decode
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _same_type(row_type: Optional[str], mine: Optional[str]) -> bool:
|
||||||
|
"""An untyped row, or a download whose type does not read, matches
|
||||||
|
conservatively: it may be this event."""
|
||||||
|
return row_type is None or mine is None or row_type.casefold() == mine.casefold()
|
||||||
|
|
||||||
|
|
||||||
def persist_download(dl: DownloadedEvent, *, store: Any, db: Any) -> EventDownload:
|
def persist_download(dl: DownloadedEvent, *, store: Any, db: Any) -> EventDownload:
|
||||||
# Never merge: a row for (serial, timestamp) means the event is stored, and
|
# Never merge: a row for (serial, timestamp, record type) means the event is
|
||||||
# whoever stored it first keeps it. No store call, no insert, no sidecar.
|
# stored, and whoever stored it first keeps it. No store call, no insert, no
|
||||||
|
# sidecar. The type matters since #51: a waveform and a histogram recorded in
|
||||||
|
# the same second (Histogram + Continuous) are two events.
|
||||||
|
kind = _download_record_type(dl)
|
||||||
if dl.timestamp is not None:
|
if dl.timestamp is not None:
|
||||||
rows = db.query_events(serial=dl.serial, from_dt=dl.timestamp, to_dt=dl.timestamp, limit=1)
|
rows = db.query_events(serial=dl.serial, from_dt=dl.timestamp, to_dt=dl.timestamp, limit=10)
|
||||||
|
rows = [r for r in rows if _same_type(r.get("record_type"), kind)]
|
||||||
if rows:
|
if rows:
|
||||||
return _already_stored(dl, rows[0])
|
return _already_stored(dl, rows[0])
|
||||||
# A histogram's row is stored at its file's time, a second before the unit's
|
# The Blastware name encodes the event's second (a second guard; before #51 a
|
||||||
# on most (#51), so the time above misses it; its Blastware name does not.
|
# histogram's row sat a second off the unit's time). Both twins share the
|
||||||
row = db.find_event_by_blastware_name(dl.serial, dl.filename)
|
# letterless name, so it too is held to the type.
|
||||||
|
row = db.find_event_by_blastware_name(dl.serial, dl.filename, record_type=kind)
|
||||||
if row is not None:
|
if row is not None:
|
||||||
return _already_stored(dl, row)
|
return _already_stored(dl, row)
|
||||||
if dl.series == 4:
|
if dl.series == 4:
|
||||||
|
|||||||
@@ -0,0 +1,130 @@
|
|||||||
|
"""
|
||||||
|
sfm/mlg_ingest.py — take in one Blastware .MLG: verify it, work out its unit,
|
||||||
|
keep the original, store its records once.
|
||||||
|
|
||||||
|
Shared by POST /db/import/mlg_file and scripts/import_mlg_dir.py. Spec:
|
||||||
|
docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md §3, §5, §6.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import hashlib
|
||||||
|
import logging
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from minimateplus.mlg_file import MlgFormatError, parse_mlg
|
||||||
|
|
||||||
|
log = logging.getLogger("sfm.mlg_ingest")
|
||||||
|
|
||||||
|
_MODEM_EXIT = 0x0020
|
||||||
|
# A serial becomes a directory in the waveform store, and a header serial comes
|
||||||
|
# from the file's own bytes: only plain serials (BE6907, UM20147) are used.
|
||||||
|
_SERIAL_RE = re.compile(r"[A-Za-z0-9]{1,16}")
|
||||||
|
|
||||||
|
|
||||||
|
def usable_serial(serial: Optional[str]) -> bool:
|
||||||
|
return bool(serial) and _SERIAL_RE.fullmatch(serial) is not None
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_serial(
|
||||||
|
file_name: str,
|
||||||
|
header_serial: Optional[str],
|
||||||
|
hint: Optional[str],
|
||||||
|
known: set[str],
|
||||||
|
) -> Optional[str]:
|
||||||
|
"""The unit a .MLG belongs to.
|
||||||
|
|
||||||
|
The serial inside the file wins; then the caller's hint. An empty file
|
||||||
|
carries none, and its name is <serial><counter> with nothing between, so
|
||||||
|
take the longest serial SFM already knows that the name starts with,
|
||||||
|
followed only by digits (or nothing: DL2's first file was BE8081.MLG).
|
||||||
|
None when nothing fits."""
|
||||||
|
if header_serial:
|
||||||
|
return header_serial
|
||||||
|
if hint:
|
||||||
|
return hint
|
||||||
|
stem = Path(file_name).name
|
||||||
|
if stem.upper().endswith(".MLG"):
|
||||||
|
stem = stem[:-4]
|
||||||
|
def fits(serial: str) -> bool:
|
||||||
|
counter = stem[len(serial):]
|
||||||
|
return stem.upper().startswith(serial.upper()) and (counter == "" or counter.isdigit())
|
||||||
|
|
||||||
|
candidates = [s for s in known if fits(s)]
|
||||||
|
return max(candidates, key=len) if candidates else None
|
||||||
|
|
||||||
|
|
||||||
|
def ingest_mlg(
|
||||||
|
db,
|
||||||
|
store,
|
||||||
|
file_name: str,
|
||||||
|
data: bytes,
|
||||||
|
*,
|
||||||
|
serial_hint: Optional[str] = None,
|
||||||
|
file_mtime: Optional[datetime.datetime] = None,
|
||||||
|
call_in: bool = True,
|
||||||
|
) -> dict:
|
||||||
|
"""Ingest one .MLG. Never raises for a bad file: the result says what happened.
|
||||||
|
|
||||||
|
status "error": not a whole .MLG, or any record fails its checksum — nothing
|
||||||
|
of it is stored. status "duplicate": this name with these bytes is already
|
||||||
|
stored. status "ok": the original is kept and its new records stored."""
|
||||||
|
result = {
|
||||||
|
"filename": file_name, "status": "error", "detail": None, "serial": None,
|
||||||
|
"serial_unresolved": False, "empty": False, "records": 0,
|
||||||
|
"inserted": 0, "skipped": 0, "file_id": None,
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
mlg = parse_mlg(data)
|
||||||
|
except MlgFormatError as exc:
|
||||||
|
result["detail"] = str(exc)
|
||||||
|
return result
|
||||||
|
result["records"] = len(mlg.records)
|
||||||
|
result["empty"] = mlg.empty
|
||||||
|
if mlg.crc_failures:
|
||||||
|
result["detail"] = ", ".join(f"record {i}" for i in mlg.crc_failures) + " fails its checksum"
|
||||||
|
return result
|
||||||
|
|
||||||
|
header = mlg.serial or None
|
||||||
|
for label, value in (("the file's serial", header), ("the serial hint", serial_hint)):
|
||||||
|
if value is not None and not usable_serial(value):
|
||||||
|
result["detail"] = f"{label} {value!r} is not a plain serial"
|
||||||
|
return result
|
||||||
|
known = db.known_serials() if not (header or serial_hint) else set()
|
||||||
|
serial = resolve_serial(file_name, header, serial_hint, known)
|
||||||
|
if mlg.records and serial is None:
|
||||||
|
result["detail"] = "no serial: the file's header carries none and no hint was given"
|
||||||
|
return result
|
||||||
|
result["serial"] = serial
|
||||||
|
result["serial_unresolved"] = serial is None
|
||||||
|
|
||||||
|
# What this file says about calls, kept per file: a record stored once may
|
||||||
|
# have arrived first in another file (a cable download). The file was sent
|
||||||
|
# by the call that ended its last record; every earlier Modem Exit in it was
|
||||||
|
# a call that left no file.
|
||||||
|
last_stop = mlg.records[-1].stop if mlg.records else None
|
||||||
|
no_file_stops = [r.stop for r in mlg.records[:-1]
|
||||||
|
if not r.is_start and r.flags & _MODEM_EXIT and r.stop]
|
||||||
|
|
||||||
|
sha256 = hashlib.sha256(data).hexdigest()
|
||||||
|
if db.mlg_file_exists(file_name, sha256):
|
||||||
|
result["status"] = "duplicate"
|
||||||
|
result["detail"] = "this file is already stored"
|
||||||
|
return result
|
||||||
|
|
||||||
|
stored_path = store.save_mlg(serial, file_name, data)
|
||||||
|
file_id, inserted, skipped = db.insert_mlg(
|
||||||
|
serial=serial, file_name=file_name, sha256=sha256, size=len(data), empty=mlg.empty,
|
||||||
|
call_in=call_in, file_mtime=file_mtime, stored_path=stored_path, records=mlg.records,
|
||||||
|
last_stop=last_stop, no_file_stops=no_file_stops,
|
||||||
|
)
|
||||||
|
if file_id is None: # stored between the check and the insert
|
||||||
|
result["status"] = "duplicate"
|
||||||
|
result["detail"] = "this file is already stored"
|
||||||
|
return result
|
||||||
|
result.update(status="ok", file_id=file_id, inserted=inserted, skipped=skipped)
|
||||||
|
log.info("mlg %s serial=%s inserted=%d skipped=%d", file_name, serial, inserted, skipped)
|
||||||
|
return result
|
||||||
@@ -0,0 +1,359 @@
|
|||||||
|
"""
|
||||||
|
sfm/mlg_timeline.py — a unit's monitoring timeline from its .MLG records.
|
||||||
|
|
||||||
|
Pure: takes the rows SeismoDb.query_mlg_records / query_mlg_files return and
|
||||||
|
gives back plain dicts (times as ISO strings). Spec §4,
|
||||||
|
docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md.
|
||||||
|
|
||||||
|
How sessions appear in a .MLG (measured on BE6907, BE12844, BE8081):
|
||||||
|
* a session with no events is one closed record: start, stop and why it stopped
|
||||||
|
* a session with events is a "monitoring started" record (flags 0xFFFF, no
|
||||||
|
stop), then the events, in the same file; the unit calls in after each
|
||||||
|
event and monitoring resumes as a new session, so the first session's end
|
||||||
|
is not written anywhere -- it lies between its last event's stop and the
|
||||||
|
next start
|
||||||
|
* a histogram session is a "monitoring started" record at T, then a histogram
|
||||||
|
record from T+1 s to the stop, carrying the stop reason
|
||||||
|
|
||||||
|
Times are the unit's own clock. When it steps back an hour after daylight
|
||||||
|
saving ends, a session starts before the previous one stopped: that is a clock
|
||||||
|
step, never a negative gap. Sessions are built in start order, but an event
|
||||||
|
always joins the "monitoring started" record of its own file, so a call-in on
|
||||||
|
the step day cannot move an event into the wrong session.
|
||||||
|
|
||||||
|
Every session and call-in names the records and files it rests on, so a shot
|
||||||
|
report can attach the original .MLG (GET /db/mlg_files/{id}).
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from minimateplus.event_file_io import monitor_log_description
|
||||||
|
|
||||||
|
_STARTED = 0xFFFF
|
||||||
|
_RECORDED = 0x0001
|
||||||
|
_HISTOGRAM_SOURCE = 0x0400
|
||||||
|
_JOIN_SECONDS = 2 # a histogram record starts 1 s after its "started" record
|
||||||
|
|
||||||
|
_GAP_MEANING = {
|
||||||
|
"Modem Exit": "call-in",
|
||||||
|
"Timer Stop": "scheduled off",
|
||||||
|
"Battery Low Exit": "lost power",
|
||||||
|
"Keyboard Exit": "stopped by a person",
|
||||||
|
"Remote Exit": "stopped by a person",
|
||||||
|
"Memory Full Exit": "memory full",
|
||||||
|
}
|
||||||
|
# A call-in takes minutes (BE12844 2, BE8081 5, measured). A longer gap after a
|
||||||
|
# Modem Exit, with no call-in file missing, is a unit that did not restart (BE6907
|
||||||
|
# for 14 days from 2026-10-07; BE8081 over Labor Day 2019).
|
||||||
|
_LONG_CALL_IN_MINUTES = 60
|
||||||
|
NO_RESTART = "no restart after a call-in"
|
||||||
|
# Each call-in file holds everything since the previous one and is numbered
|
||||||
|
# <serial><counter>. Records can be missing only where a number is: then the
|
||||||
|
# gap cannot say the unit was not monitoring.
|
||||||
|
RECORDS_MISSING = "records missing"
|
||||||
|
_MISSING_LISTED = 20
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class _Rec:
|
||||||
|
id: str
|
||||||
|
file_id: str
|
||||||
|
start: datetime.datetime
|
||||||
|
stop: Optional[datetime.datetime]
|
||||||
|
flags: int
|
||||||
|
source: int
|
||||||
|
trigger_level: Optional[str]
|
||||||
|
seq: int
|
||||||
|
|
||||||
|
|
||||||
|
def _dt(value: Optional[str]) -> Optional[datetime.datetime]:
|
||||||
|
if not value:
|
||||||
|
return None
|
||||||
|
if value.endswith("Z"): # Python 3.10's fromisoformat rejects "Z"
|
||||||
|
value = value[:-1] + "+00:00"
|
||||||
|
return datetime.datetime.fromisoformat(value)
|
||||||
|
|
||||||
|
|
||||||
|
def _iso(value: Optional[datetime.datetime]) -> Optional[str]:
|
||||||
|
return value.isoformat() if value else None
|
||||||
|
|
||||||
|
|
||||||
|
def _ended_by(flags: int) -> Optional[str]:
|
||||||
|
return monitor_log_description(flags & ~_RECORDED & 0xFFFF).strip() or None
|
||||||
|
|
||||||
|
|
||||||
|
def _kind(r: _Rec) -> str:
|
||||||
|
if r.flags == _STARTED or r.stop is None:
|
||||||
|
return "start" # no stop: monitoring began here, its end is not known
|
||||||
|
if r.flags & _RECORDED:
|
||||||
|
return "histogram" if r.source == _HISTOGRAM_SOURCE else "event"
|
||||||
|
return "closed"
|
||||||
|
|
||||||
|
|
||||||
|
def _session(start, *, stop=None, ended_by=None, kind="monitoring", trigger_level=None) -> dict:
|
||||||
|
return {"start": start, "stop": stop, "end_after": None, "end_before": None,
|
||||||
|
"ended_by": ended_by, "kind": kind, "trigger_level": trigger_level,
|
||||||
|
"running_at_last_report": False, "events": [], "record_ids": [], "file_ids": []}
|
||||||
|
|
||||||
|
|
||||||
|
def _note(s: dict, r: _Rec) -> None:
|
||||||
|
s["record_ids"].append(r.id)
|
||||||
|
if r.file_id not in s["file_ids"]:
|
||||||
|
s["file_ids"].append(r.file_id)
|
||||||
|
|
||||||
|
|
||||||
|
def _event(r: _Rec) -> dict:
|
||||||
|
return {"start": r.start, "stop": r.stop, "trigger_source": r.source,
|
||||||
|
"trigger_level": r.trigger_level, "record_id": r.id,
|
||||||
|
"description": monitor_log_description(r.flags).strip()}
|
||||||
|
|
||||||
|
|
||||||
|
def _last_running_point(s: dict) -> datetime.datetime:
|
||||||
|
if s["events"]:
|
||||||
|
return s["events"][-1]["stop"] or s["events"][-1]["start"]
|
||||||
|
return s["start"]
|
||||||
|
|
||||||
|
|
||||||
|
def _sessions(recs: list[_Rec]) -> list[dict]:
|
||||||
|
sessions: list[dict] = []
|
||||||
|
pending: Optional[dict] = None # a session whose stop is not known yet
|
||||||
|
started_in_file: dict[str, dict] = {} # file id -> the session its latest start record opened
|
||||||
|
|
||||||
|
def close_pending(before: datetime.datetime) -> None:
|
||||||
|
nonlocal pending
|
||||||
|
if pending is not None:
|
||||||
|
pending["end_after"] = _last_running_point(pending)
|
||||||
|
pending["end_before"] = before
|
||||||
|
pending = None
|
||||||
|
|
||||||
|
def own_file_session(r: _Rec) -> Optional[dict]:
|
||||||
|
s = started_in_file.get(r.file_id)
|
||||||
|
if s is None or r.start < s["start"]:
|
||||||
|
return None
|
||||||
|
if s["stop"] is not None and r.start > s["stop"]:
|
||||||
|
return None
|
||||||
|
return s
|
||||||
|
|
||||||
|
for r in recs:
|
||||||
|
kind = _kind(r)
|
||||||
|
if kind == "start":
|
||||||
|
close_pending(r.start)
|
||||||
|
pending = _session(r.start, trigger_level=r.trigger_level)
|
||||||
|
_note(pending, r)
|
||||||
|
started_in_file[r.file_id] = pending
|
||||||
|
sessions.append(pending)
|
||||||
|
elif kind == "histogram":
|
||||||
|
if pending is not None and (r.start - pending["start"]).total_seconds() <= _JOIN_SECONDS:
|
||||||
|
pending.update(stop=r.stop, kind="histogram", ended_by=_ended_by(r.flags))
|
||||||
|
pending["trigger_level"] = pending["trigger_level"] or r.trigger_level
|
||||||
|
_note(pending, r)
|
||||||
|
pending = None
|
||||||
|
else:
|
||||||
|
close_pending(r.start)
|
||||||
|
s = _session(r.start, stop=r.stop, kind="histogram",
|
||||||
|
ended_by=_ended_by(r.flags), trigger_level=r.trigger_level)
|
||||||
|
_note(s, r)
|
||||||
|
sessions.append(s)
|
||||||
|
elif kind == "event":
|
||||||
|
own = own_file_session(r)
|
||||||
|
last = sessions[-1] if sessions else None
|
||||||
|
if own is not None:
|
||||||
|
own["events"].append(_event(r))
|
||||||
|
_note(own, r)
|
||||||
|
if own is pending:
|
||||||
|
if _ended_by(r.flags):
|
||||||
|
own.update(stop=r.stop, ended_by=_ended_by(r.flags))
|
||||||
|
pending = None
|
||||||
|
elif own["stop"] is None:
|
||||||
|
# A later session (another file) closed its window first: the
|
||||||
|
# unit's clock stepped back at the call-in after this event.
|
||||||
|
own["end_after"] = _last_running_point(own)
|
||||||
|
if own["end_before"] is not None and own["end_after"] > own["end_before"]:
|
||||||
|
own["end_before"] = None
|
||||||
|
elif last is not None and last["stop"] is not None and last["start"] <= r.start <= last["stop"]:
|
||||||
|
last["events"].append(_event(r))
|
||||||
|
_note(last, r)
|
||||||
|
elif pending is not None:
|
||||||
|
pending["events"].append(_event(r))
|
||||||
|
_note(pending, r)
|
||||||
|
if _ended_by(r.flags):
|
||||||
|
pending.update(stop=r.stop, ended_by=_ended_by(r.flags))
|
||||||
|
pending = None
|
||||||
|
else:
|
||||||
|
s = _session(r.start, trigger_level=r.trigger_level)
|
||||||
|
s["events"].append(_event(r))
|
||||||
|
_note(s, r)
|
||||||
|
if _ended_by(r.flags):
|
||||||
|
s.update(stop=r.stop, ended_by=_ended_by(r.flags))
|
||||||
|
else:
|
||||||
|
pending = s
|
||||||
|
sessions.append(s)
|
||||||
|
else:
|
||||||
|
close_pending(r.start)
|
||||||
|
s = _session(r.start, stop=r.stop, ended_by=_ended_by(r.flags),
|
||||||
|
trigger_level=r.trigger_level)
|
||||||
|
_note(s, r)
|
||||||
|
sessions.append(s)
|
||||||
|
if pending is not None:
|
||||||
|
pending["running_at_last_report"] = True
|
||||||
|
pending["end_after"] = _last_running_point(pending)
|
||||||
|
return sessions
|
||||||
|
|
||||||
|
|
||||||
|
def _counter(file_name: str, serial: Optional[str]) -> Optional[int]:
|
||||||
|
"""The call-in number in <serial><counter>.MLG; a bare <serial>.MLG is 0."""
|
||||||
|
stem = file_name[:-4] if file_name.upper().endswith(".MLG") else file_name
|
||||||
|
if not serial or not stem.upper().startswith(serial.upper()):
|
||||||
|
return None
|
||||||
|
rest = stem[len(serial):]
|
||||||
|
if rest == "":
|
||||||
|
return 0
|
||||||
|
return int(rest) if rest.isdigit() else None
|
||||||
|
|
||||||
|
|
||||||
|
def _missing_between(a: Optional[int], b: Optional[int], received: set[int]) -> list[int]:
|
||||||
|
if a is None or b is None or b <= a + 1:
|
||||||
|
return []
|
||||||
|
return [c for c in range(a + 1, b) if c not in received][:_MISSING_LISTED]
|
||||||
|
|
||||||
|
|
||||||
|
def _gaps_and_steps(sessions: list[dict], counter_of: dict[str, Optional[int]],
|
||||||
|
received: set[int]) -> tuple[list[dict], list[dict]]:
|
||||||
|
gaps, steps = [], []
|
||||||
|
for prev, nxt in zip(sessions, sessions[1:]):
|
||||||
|
end = prev["stop"] or prev["end_after"]
|
||||||
|
minutes = (nxt["start"] - end).total_seconds() / 60
|
||||||
|
if nxt["start"] < end:
|
||||||
|
steps.append({"previous_stop": end, "next_start": nxt["start"], "minutes": minutes})
|
||||||
|
continue
|
||||||
|
missing = _missing_between(counter_of.get(prev["file_ids"][-1]),
|
||||||
|
counter_of.get(nxt["file_ids"][0]), received)
|
||||||
|
meaning = _GAP_MEANING.get(prev["ended_by"], "unknown")
|
||||||
|
if missing:
|
||||||
|
meaning = RECORDS_MISSING
|
||||||
|
elif meaning == "call-in" and minutes > _LONG_CALL_IN_MINUTES:
|
||||||
|
meaning = NO_RESTART
|
||||||
|
gaps.append({"start": end, "stop": nxt["start"], "minutes": minutes, "meaning": meaning,
|
||||||
|
"missing_files": missing})
|
||||||
|
return gaps, steps
|
||||||
|
|
||||||
|
|
||||||
|
def _call_ins(files: list[dict]) -> list[dict]:
|
||||||
|
"""From each file's own call summary, written when it arrived (a record
|
||||||
|
stored once may have come first in another file)."""
|
||||||
|
out = []
|
||||||
|
for f in files:
|
||||||
|
if not f["call_in"]:
|
||||||
|
continue
|
||||||
|
base = {"file_name": f["file_name"], "file_id": f["id"]}
|
||||||
|
file_time = _iso(_dt(f["file_mtime"] or f["received_at"]))
|
||||||
|
if not f["record_count"]:
|
||||||
|
out.append({"kind": "nothing_new", "unit_time": None, "file_time": file_time, **base})
|
||||||
|
continue
|
||||||
|
for stop in json.loads(f["no_file_stops"] or "[]"):
|
||||||
|
out.append({"kind": "no_file", "unit_time": stop, "file_time": None, **base})
|
||||||
|
out.append({"kind": "delivered", "unit_time": f["last_stop"], "file_time": file_time, **base})
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def build_timeline(records: list[dict], files: list[dict]) -> dict:
|
||||||
|
"""Sessions, gaps (with what each means), clock steps and call-ins."""
|
||||||
|
recs = sorted(
|
||||||
|
(_Rec(r["id"], r["file_id"], _dt(r["start_time"]), _dt(r["stop_time"]), r["flags"],
|
||||||
|
r["trigger_source"], r["trigger_level"], r["seq"]) for r in records),
|
||||||
|
key=lambda r: (r.start, 0 if r.flags == _STARTED else 1, r.seq),
|
||||||
|
)
|
||||||
|
sessions = _sessions(recs)
|
||||||
|
counter_of = {f["id"]: _counter(f["file_name"], f["serial"]) for f in files if f["call_in"]}
|
||||||
|
received = {c for c in counter_of.values() if c is not None}
|
||||||
|
gaps, steps = _gaps_and_steps(sessions, counter_of, received)
|
||||||
|
for s in sessions:
|
||||||
|
for key in ("start", "stop", "end_after", "end_before"):
|
||||||
|
s[key] = _iso(s[key])
|
||||||
|
for e in s["events"]:
|
||||||
|
e["start"], e["stop"] = _iso(e["start"]), _iso(e["stop"])
|
||||||
|
for g in gaps:
|
||||||
|
g["start"], g["stop"] = _iso(g["start"]), _iso(g["stop"])
|
||||||
|
for c in steps:
|
||||||
|
c["previous_stop"], c["next_start"] = _iso(c["previous_stop"]), _iso(c["next_start"])
|
||||||
|
return {"sessions": sessions, "gaps": gaps, "clock_steps": steps, "call_ins": _call_ins(files)}
|
||||||
|
|
||||||
|
|
||||||
|
def window(timeline: dict, from_dt: Optional[datetime.datetime],
|
||||||
|
to_dt: Optional[datetime.datetime]) -> dict:
|
||||||
|
"""The parts of a timeline that overlap [from_dt, to_dt] (the unit's clock).
|
||||||
|
|
||||||
|
Sessions, gaps and clock steps are on the unit's clock and filter exactly.
|
||||||
|
A call-in with a unit time filters by it. A nothing_new call-in has only
|
||||||
|
the PC's file time (UTC); it is kept when within a day of the window, since
|
||||||
|
the unit's local clock and UTC differ by hours and cannot be compared
|
||||||
|
exactly."""
|
||||||
|
lo = from_dt or datetime.datetime.min
|
||||||
|
hi = to_dt or datetime.datetime.max
|
||||||
|
|
||||||
|
def overlaps(start: Optional[str], end: Optional[str]) -> bool:
|
||||||
|
s = _dt(start) or datetime.datetime.min
|
||||||
|
e = _dt(end) or datetime.datetime.max
|
||||||
|
return s <= hi and e >= lo
|
||||||
|
|
||||||
|
def call_in_kept(c: dict) -> bool:
|
||||||
|
if c["unit_time"]:
|
||||||
|
return lo <= _dt(c["unit_time"]) <= hi
|
||||||
|
if not c["file_time"]:
|
||||||
|
return True
|
||||||
|
t = _dt(c["file_time"]).replace(tzinfo=None)
|
||||||
|
day = datetime.timedelta(days=1)
|
||||||
|
return (lo == datetime.datetime.min or t >= lo - day) and (hi == datetime.datetime.max or t <= hi + day)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"sessions": [s for s in timeline["sessions"]
|
||||||
|
if overlaps(s["start"], None if s["running_at_last_report"]
|
||||||
|
else s["stop"] or s["end_before"])],
|
||||||
|
"gaps": [g for g in timeline["gaps"] if overlaps(g["start"], g["stop"])],
|
||||||
|
"clock_steps": [c for c in timeline["clock_steps"] if overlaps(c["next_start"], c["previous_stop"])],
|
||||||
|
"call_ins": [c for c in timeline["call_ins"] if call_in_kept(c)],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def monitoring_at(timeline: dict, at: datetime.datetime) -> dict:
|
||||||
|
"""Was the unit monitoring at `at` (its own clock)?
|
||||||
|
|
||||||
|
monitoring: inside a session (boundaries included); two sessions matching
|
||||||
|
(the repeated hour after a clock step back) set ambiguous. unknown: inside
|
||||||
|
a session's unrecorded end, after its last report, where a call-in file is
|
||||||
|
missing (records missing), or where no record reaches.
|
||||||
|
not_monitoring: inside a gap, with what the gap means."""
|
||||||
|
result = {"status": "unknown", "ambiguous": False, "sessions": [], "gap": None,
|
||||||
|
"trigger_level": None, "reason": "no record covers this time"}
|
||||||
|
matches = []
|
||||||
|
for s in timeline["sessions"]:
|
||||||
|
start, end = _dt(s["start"]), _dt(s["stop"]) or _dt(s["end_after"])
|
||||||
|
if start <= at <= end:
|
||||||
|
matches.append(s)
|
||||||
|
if matches:
|
||||||
|
result.update(status="monitoring", ambiguous=len(matches) > 1, sessions=matches,
|
||||||
|
trigger_level=matches[0]["trigger_level"], reason="inside a monitoring session")
|
||||||
|
return result
|
||||||
|
for s in timeline["sessions"]:
|
||||||
|
if s["stop"] is not None or _dt(s["end_after"]) >= at:
|
||||||
|
continue
|
||||||
|
if s["running_at_last_report"]:
|
||||||
|
result.update(sessions=[s], reason="after the unit's last report")
|
||||||
|
return result
|
||||||
|
if s["end_before"] is not None and at < _dt(s["end_before"]):
|
||||||
|
result.update(sessions=[s], reason="the session's end was not recorded")
|
||||||
|
return result
|
||||||
|
for g in timeline["gaps"]:
|
||||||
|
if _dt(g["start"]) < at < _dt(g["stop"]):
|
||||||
|
if g["meaning"] == RECORDS_MISSING:
|
||||||
|
result.update(gap=g, reason="call-in file(s) not received: "
|
||||||
|
+ ", ".join(f"#{c}" for c in g["missing_files"]))
|
||||||
|
else:
|
||||||
|
result.update(status="not_monitoring", gap=g, reason=g["meaning"])
|
||||||
|
return result
|
||||||
|
return result
|
||||||
+165
-134
@@ -43,6 +43,7 @@ or:
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
@@ -50,11 +51,11 @@ import tempfile
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Mapping, Optional
|
from typing import Any, Dict, Mapping, Optional
|
||||||
|
|
||||||
# FastAPI / Pydantic
|
# FastAPI / Pydantic
|
||||||
try:
|
try:
|
||||||
from fastapi import Body, FastAPI, File, HTTPException, Query, Response, UploadFile
|
from fastapi import Body, FastAPI, File, Form, HTTPException, Query, Response, UploadFile
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.responses import FileResponse, JSONResponse, StreamingResponse
|
from fastapi.responses import FileResponse, JSONResponse, StreamingResponse
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
@@ -84,6 +85,8 @@ from sfm.live_cache import LiveCache as _LiveCache
|
|||||||
from sfm.waveform_store import WaveformStore
|
from sfm.waveform_store import WaveformStore
|
||||||
from sfm import db_snapshot
|
from sfm import db_snapshot
|
||||||
from sfm.event_ingest import backfill_series3_event, persist_download
|
from sfm.event_ingest import backfill_series3_event, persist_download
|
||||||
|
from sfm.mlg_ingest import ingest_mlg
|
||||||
|
from sfm.mlg_timeline import build_timeline, monitoring_at as mlg_monitoring_at, window as mlg_window
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from sfm.device_access import DeviceAccess, DeviceError, UnitAddress
|
from sfm.device_access import DeviceAccess, DeviceError, UnitAddress
|
||||||
from sfm.device_access.errors import BadRequest, ChangeUnconfirmed
|
from sfm.device_access.errors import BadRequest, ChangeUnconfirmed
|
||||||
@@ -426,6 +429,7 @@ _SERIAL_AWARE_PATHS = frozenset({
|
|||||||
"/device/events", "/device/events/download",
|
"/device/events", "/device/events/download",
|
||||||
"/device/monitor/start", "/device/monitor/stop",
|
"/device/monitor/start", "/device/monitor/stop",
|
||||||
"/device/call_home/state", "/device/call_home/enable", "/device/call_home/disable",
|
"/device/call_home/state", "/device/call_home/enable", "/device/call_home/disable",
|
||||||
|
"/device/settings/change",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -1112,145 +1116,61 @@ def device_event_blastware_file(
|
|||||||
|
|
||||||
# ── Write endpoints ───────────────────────────────────────────────────────────
|
# ── Write endpoints ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
class DeviceConfigBody(BaseModel):
|
_CONFIG_RETIRED = ("retired: change a unit's settings by serial with POST /device/settings/change "
|
||||||
"""
|
"(audited, previewed, read back)")
|
||||||
Request body for POST /device/config.
|
|
||||||
|
|
||||||
All fields are optional — only supplied (non-null) fields are written to
|
|
||||||
the device. All other config bytes are round-tripped verbatim.
|
|
||||||
|
|
||||||
Recording parameters
|
|
||||||
--------------------
|
|
||||||
recording_mode : Recording mode enum. Values: 0=Single Shot, 1=Continuous, 3=Histogram, 4=Histogram+Continuous.
|
|
||||||
sample_rate : Samples per second. Valid values: 1024, 2048, 4096.
|
|
||||||
record_time : Record duration in seconds (e.g. 1.0, 2.0, 3.0).
|
|
||||||
|
|
||||||
Trigger / alarm thresholds and range (geo channels)
|
|
||||||
----------------------------------------------------
|
|
||||||
trigger_level_geo : Trigger threshold in in/s (e.g. 0.5).
|
|
||||||
alarm_level_geo : Alarm threshold in in/s (e.g. 1.0).
|
|
||||||
geo_range : Geophone range/sensitivity. 0=Normal 10.000 in/s, 1=Sensitive 1.250 in/s.
|
|
||||||
Project / operator strings (max 41 ASCII characters each)
|
|
||||||
----------------------------
|
|
||||||
project : Project description.
|
|
||||||
client_name : Client / company name.
|
|
||||||
operator : Operator / technician name.
|
|
||||||
seis_loc : Sensor location description.
|
|
||||||
notes : Extended notes.
|
|
||||||
"""
|
|
||||||
# Recording parameters
|
|
||||||
recording_mode: Optional[int] = None
|
|
||||||
sample_rate: Optional[int] = None
|
|
||||||
record_time: Optional[float] = None
|
|
||||||
histogram_interval_sec: Optional[int] = None # seconds: 2, 5, 15, 60, 300, 900 (mode-gated)
|
|
||||||
# Threshold parameters / geo range
|
|
||||||
trigger_level_geo: Optional[float] = None
|
|
||||||
alarm_level_geo: Optional[float] = None
|
|
||||||
geo_range: Optional[int] = None # 0=Normal 10.000 in/s, 1=Sensitive 1.250 in/s
|
|
||||||
# Project / operator strings
|
|
||||||
project: Optional[str] = None
|
|
||||||
client_name: Optional[str] = None
|
|
||||||
operator: Optional[str] = None
|
|
||||||
seis_loc: Optional[str] = None
|
|
||||||
notes: Optional[str] = None
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/device/config")
|
@app.post("/device/config")
|
||||||
def device_config(
|
def device_config() -> JSONResponse:
|
||||||
body: DeviceConfigBody,
|
"""Retired (phase 5, 2026-11-03). It wrote a MiniMate's settings through an
|
||||||
port: Optional[str] = Query(None, description="Serial port (e.g. COM5)"),
|
encoder #46 found wrong, unaudited, with no read-back, retrying the whole
|
||||||
baud: int = Query(38400, description="Serial baud rate"),
|
write on a TCP error. Use POST /device/settings/change."""
|
||||||
host: Optional[str] = Query(None, description="TCP host — modem IP or ACH relay"),
|
return JSONResponse(status_code=410, content={"detail": _CONFIG_RETIRED})
|
||||||
tcp_port: int = Query(DEFAULT_TCP_PORT, description=f"TCP port (default {DEFAULT_TCP_PORT})"),
|
|
||||||
serial: Optional[str] = Query(None, description=_SERIAL_CHECK_DOC),
|
|
||||||
) -> dict:
|
|
||||||
"""
|
|
||||||
Read the current device config, apply any supplied changes to the compliance
|
|
||||||
block, and write the full config back.
|
|
||||||
|
|
||||||
Only non-null fields in the JSON body are modified. All other config bytes
|
|
||||||
are round-tripped verbatim from the device.
|
|
||||||
|
|
||||||
Supply either *port* (serial) or *host* (TCP/modem).
|
|
||||||
|
|
||||||
Example body (all fields optional — include only what you want to change):
|
|
||||||
{
|
|
||||||
"recording_mode": 1,
|
|
||||||
"sample_rate": 1024,
|
|
||||||
"record_time": 3.0,
|
|
||||||
"trigger_level_geo": 0.5,
|
|
||||||
"alarm_level_geo": 1.0,
|
|
||||||
"project": "Bridge Inspection 2026",
|
|
||||||
"client_name": "City of Portland",
|
|
||||||
"operator": "Brian Harrison",
|
|
||||||
"seis_loc": "South Abutment",
|
|
||||||
"notes": "Pre-blast baseline"
|
|
||||||
}
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
{"status": "ok", "updated_fields": {...}} on success.
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
502 on protocol errors (timeout, bad ack, etc.).
|
|
||||||
422 if neither port nor host is provided.
|
|
||||||
"""
|
|
||||||
changed = body.model_dump(exclude_none=True)
|
|
||||||
conn_key = _live_cache.make_conn_key(host, tcp_port, port, baud)
|
|
||||||
log.info("POST /device/config port=%s host=%s fields=%s", port, host, list(changed.keys()))
|
|
||||||
|
|
||||||
try:
|
|
||||||
def _do():
|
|
||||||
with _build_client(port, baud, host, tcp_port) as client:
|
|
||||||
info = client.connect()
|
|
||||||
_require_series3(info.serial, serial)
|
|
||||||
client.apply_config(
|
|
||||||
recording_mode=body.recording_mode,
|
|
||||||
sample_rate=body.sample_rate,
|
|
||||||
record_time=body.record_time,
|
|
||||||
histogram_interval_sec=body.histogram_interval_sec,
|
|
||||||
trigger_level_geo=body.trigger_level_geo,
|
|
||||||
alarm_level_geo=body.alarm_level_geo,
|
|
||||||
geo_range=body.geo_range,
|
|
||||||
project=body.project,
|
|
||||||
client_name=body.client_name,
|
|
||||||
operator=body.operator,
|
|
||||||
seis_loc=body.seis_loc,
|
|
||||||
notes=body.notes,
|
|
||||||
)
|
|
||||||
_run_with_retry(_do, is_tcp=_is_tcp(host))
|
|
||||||
except HTTPException:
|
|
||||||
raise
|
|
||||||
except ProtocolError as exc:
|
|
||||||
raise HTTPException(status_code=502, detail=f"Protocol error: {exc}") from exc
|
|
||||||
except OSError as exc:
|
|
||||||
raise HTTPException(status_code=502, detail=f"Connection error: {exc}") from exc
|
|
||||||
except ValueError as exc:
|
|
||||||
raise HTTPException(status_code=422, detail=str(exc)) from exc
|
|
||||||
except Exception as exc:
|
|
||||||
raise HTTPException(status_code=500, detail=f"Device error: {exc}") from exc
|
|
||||||
|
|
||||||
# Config was written to the device — the cached compliance config is now stale.
|
|
||||||
conn_key = SFMCache.make_conn_key(host, tcp_port, port, baud)
|
|
||||||
get_cache().mark_config_dirty(conn_key)
|
|
||||||
|
|
||||||
return {
|
|
||||||
"status": "ok",
|
|
||||||
"updated_fields": changed,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Keep the old endpoint alive under its old URL for anything already calling it
|
|
||||||
@app.post("/device/config/project")
|
@app.post("/device/config/project")
|
||||||
def device_config_project(
|
def device_config_project() -> JSONResponse:
|
||||||
body: DeviceConfigBody,
|
"""Retired with POST /device/config -- use POST /device/settings/change."""
|
||||||
port: Optional[str] = Query(None, description="Serial port (e.g. COM5)"),
|
return JSONResponse(status_code=410, content={"detail": _CONFIG_RETIRED})
|
||||||
baud: int = Query(38400, description="Serial baud rate"),
|
|
||||||
host: Optional[str] = Query(None, description="TCP host — modem IP or ACH relay"),
|
|
||||||
|
class SettingsChangeBody(BaseModel):
|
||||||
|
"""POST /device/settings/change. `changes` maps field -> new value, using
|
||||||
|
the field names in GET /device/settings' `detail.editable`. `revision` is the
|
||||||
|
one a dry run (the preview) returned; a live change without it is refused."""
|
||||||
|
changes: Dict[str, Any]
|
||||||
|
revision: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
@app.post("/device/settings/change")
|
||||||
|
def device_settings_change(
|
||||||
|
body: SettingsChangeBody,
|
||||||
|
serial: str = Query(..., description=_SERIAL_DOC),
|
||||||
|
host: Optional[str] = Query(None, description="TCP host — modem IP"),
|
||||||
tcp_port: int = Query(DEFAULT_TCP_PORT, description=f"TCP port (default {DEFAULT_TCP_PORT})"),
|
tcp_port: int = Query(DEFAULT_TCP_PORT, description=f"TCP port (default {DEFAULT_TCP_PORT})"),
|
||||||
serial: Optional[str] = Query(None, description=_SERIAL_CHECK_DOC),
|
port: Optional[str] = Query(None, description="Serial port (e.g. COM5)"),
|
||||||
) -> dict:
|
baud: Optional[int] = Query(None, description="Serial baud rate"),
|
||||||
"""Deprecated alias for POST /device/config — use that instead."""
|
dry_run: bool = Query(False, description="Preview: old -> new and a revision; send nothing"),
|
||||||
return device_config(body=body, port=port, baud=baud, host=host, tcp_port=tcp_port, serial=serial)
|
caller: Optional[str] = Query(None, description="Who is asking (recorded in the audit row)"),
|
||||||
|
):
|
||||||
|
"""Change a unit's settings by serial, both series (spec row 10, phase 5).
|
||||||
|
|
||||||
|
Preview first (`dry_run=true`): it reads the unit and returns, per field, the
|
||||||
|
value it holds and the value it would get, any warnings, anything that blocks
|
||||||
|
the change, and a `revision`. Then send the same body live with that
|
||||||
|
revision: identity read first, refused if the unit is monitoring or its
|
||||||
|
settings changed since the preview (409), sent once, never retried, read back.
|
||||||
|
Statuses as /device/monitor/start; a change that went out but was not
|
||||||
|
confirmed carries `sent` and `audit_id`."""
|
||||||
|
resp = _change_response(lambda: _device_access().change_settings(
|
||||||
|
_unit_address(port, baud, host, tcp_port), serial, changes=body.changes,
|
||||||
|
revision=body.revision, dry_run=dry_run, caller=caller or "api"))
|
||||||
|
if not dry_run:
|
||||||
|
try: # a by-host read must not serve stale settings
|
||||||
|
get_cache().mark_config_dirty(_live_cache.make_conn_key(host, tcp_port, port, baud))
|
||||||
|
except Exception as exc: # noqa: BLE001 -- the change's answer stands
|
||||||
|
log.warning("could not mark the cached config dirty: %s", exc)
|
||||||
|
return resp
|
||||||
|
|
||||||
|
|
||||||
# ── Monitoring endpoints ───────────────────────────────────────────────────────
|
# ── Monitoring endpoints ───────────────────────────────────────────────────────
|
||||||
@@ -3150,6 +3070,117 @@ async def db_import_idf_file(
|
|||||||
return {"count": len(results), "results": results}
|
return {"count": len(results), "results": results}
|
||||||
|
|
||||||
|
|
||||||
|
# ── Blastware monitor logs (.MLG) ─────────────────────────────────────────────
|
||||||
|
# Spec: docs/superpowers/specs/2026-11-09-mlg-unit-timeline-design.md §5.
|
||||||
|
# Record and timeline times are the unit's own local clock; file times are UTC.
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_unit_time(value: Optional[str], name: str, *, required: bool = False) -> Optional[datetime.datetime]:
|
||||||
|
"""A time on the unit's own clock: ISO-8601 with no UTC offset. 400 otherwise."""
|
||||||
|
if not value:
|
||||||
|
if required:
|
||||||
|
raise HTTPException(400, f"{name} is required (ISO-8601, the unit's clock)")
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
parsed = datetime.datetime.fromisoformat(value)
|
||||||
|
except ValueError:
|
||||||
|
raise HTTPException(400, f"{name} is not an ISO-8601 time: {value!r}")
|
||||||
|
if parsed.tzinfo is not None:
|
||||||
|
raise HTTPException(400, f"{name} is on the unit's own clock and carries no UTC offset: {value!r}")
|
||||||
|
return parsed
|
||||||
|
|
||||||
|
|
||||||
|
def _mlg_timeline(serial: str) -> dict:
|
||||||
|
db = _get_db()
|
||||||
|
return build_timeline(db.query_mlg_records(serial), db.query_mlg_files(serial))
|
||||||
|
|
||||||
|
|
||||||
|
@app.post("/db/import/mlg_file")
|
||||||
|
async def db_import_mlg_file(
|
||||||
|
files: list[UploadFile] = File(...),
|
||||||
|
serial: Optional[str] = Query(None, description="Serial hint, used only for a file with no serial inside (an empty one)"),
|
||||||
|
call_in: bool = Query(True, description="False for a cable / direct download: its records are kept, but it is not a call-in"),
|
||||||
|
mtimes: Optional[str] = Form(None, description='Each file\'s modified time: JSON {"<file name>": <unix seconds, UTC>}'),
|
||||||
|
) -> dict:
|
||||||
|
"""
|
||||||
|
Multipart upload of one or more Blastware .MLG monitor logs.
|
||||||
|
|
||||||
|
Each file gets its own status ("ok" / "duplicate" / "error"); good files
|
||||||
|
are stored even when another in the same request is not. A file that is
|
||||||
|
not whole, or any of whose records fails its checksum, stores nothing.
|
||||||
|
The original is kept byte for byte in the waveform store.
|
||||||
|
"""
|
||||||
|
try: # all of it checked before any file is stored
|
||||||
|
raw_times = json.loads(mtimes) if mtimes else {}
|
||||||
|
if not isinstance(raw_times, dict):
|
||||||
|
raise ValueError("not an object")
|
||||||
|
file_times = {name: datetime.datetime.fromtimestamp(float(stamp), datetime.timezone.utc)
|
||||||
|
for name, stamp in raw_times.items()}
|
||||||
|
except (ValueError, TypeError, OverflowError, OSError) as exc:
|
||||||
|
raise HTTPException(400, f"mtimes must be a JSON object of file name -> unix seconds: {exc}")
|
||||||
|
db, store = _get_db(), _get_store()
|
||||||
|
results: list[dict] = []
|
||||||
|
for upload in files:
|
||||||
|
name = upload.filename or "unnamed.MLG"
|
||||||
|
try:
|
||||||
|
data = await upload.read()
|
||||||
|
except Exception as exc:
|
||||||
|
results.append({"filename": name, "status": "error", "detail": f"read failed: {exc}"})
|
||||||
|
continue
|
||||||
|
results.append(ingest_mlg(db, store, name, data, serial_hint=serial,
|
||||||
|
file_mtime=file_times.get(name), call_in=call_in))
|
||||||
|
return {"count": len(results), "results": results}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/db/units/{serial}/timeline")
|
||||||
|
def db_unit_timeline(
|
||||||
|
serial: str,
|
||||||
|
from_dt: Optional[str] = Query(None, description="ISO-8601, the unit's clock (inclusive)"),
|
||||||
|
to_dt: Optional[str] = Query(None, description="ISO-8601, the unit's clock (inclusive)"),
|
||||||
|
) -> dict:
|
||||||
|
"""A unit's monitoring timeline from its .MLGs: sessions (how each ended,
|
||||||
|
its events, its trigger level), gaps and what each means, clock steps, and
|
||||||
|
call-ins (delivered / no_file / nothing_new)."""
|
||||||
|
lo, hi = _parse_unit_time(from_dt, "from_dt"), _parse_unit_time(to_dt, "to_dt")
|
||||||
|
timeline = _mlg_timeline(serial)
|
||||||
|
if lo or hi:
|
||||||
|
timeline = mlg_window(timeline, lo, hi)
|
||||||
|
return {"serial": serial, **timeline}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/db/units/{serial}/monitoring_at")
|
||||||
|
def db_unit_monitoring_at(
|
||||||
|
serial: str,
|
||||||
|
at: str = Query(..., description="ISO-8601, the unit's clock"),
|
||||||
|
) -> dict:
|
||||||
|
"""Was the unit monitoring at `at`? monitoring / not_monitoring / unknown,
|
||||||
|
with the session or gap that says so and the trigger level as logged."""
|
||||||
|
when = _parse_unit_time(at, "at", required=True)
|
||||||
|
return {"serial": serial, "at": at, **mlg_monitoring_at(_mlg_timeline(serial), when)}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/db/mlg_records")
|
||||||
|
def db_mlg_records(
|
||||||
|
serial: str = Query(..., description="Unit serial"),
|
||||||
|
from_dt: Optional[str] = Query(None, description="ISO-8601 start (record start, inclusive)"),
|
||||||
|
to_dt: Optional[str] = Query(None, description="ISO-8601 end (record start, inclusive)"),
|
||||||
|
) -> dict:
|
||||||
|
"""A unit's raw .MLG records, oldest first."""
|
||||||
|
rows = _get_db().query_mlg_records(
|
||||||
|
serial, _parse_unit_time(from_dt, "from_dt"), _parse_unit_time(to_dt, "to_dt"))
|
||||||
|
return {"count": len(rows), "records": rows}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/db/mlg_files/{file_id}")
|
||||||
|
def db_mlg_file(file_id: str):
|
||||||
|
"""The original .MLG, byte for byte, for printing or opening in Blastware."""
|
||||||
|
row = _get_db().get_mlg_file(file_id)
|
||||||
|
path = _get_store().root / row["stored_path"] if row and row["stored_path"] else None
|
||||||
|
if path is None or not path.is_file():
|
||||||
|
raise HTTPException(404, f"no stored .MLG with id {file_id}")
|
||||||
|
return FileResponse(path, filename=row["file_name"], media_type="application/octet-stream")
|
||||||
|
|
||||||
|
|
||||||
@app.get("/db/units/{serial}/waveforms.zip")
|
@app.get("/db/units/{serial}/waveforms.zip")
|
||||||
def db_unit_waveforms_zip(
|
def db_unit_waveforms_zip(
|
||||||
serial: str,
|
serial: str,
|
||||||
|
|||||||
+11
-2
@@ -1020,8 +1020,18 @@
|
|||||||
<div id="tab-config" class="tab-pane">
|
<div id="tab-config" class="tab-pane">
|
||||||
|
|
||||||
<div id="cfg-settings" style="display:none; margin-bottom:12px">
|
<div id="cfg-settings" style="display:none; margin-bottom:12px">
|
||||||
<div class="cfg-section-title">On the unit (read by serial)</div>
|
<div class="cfg-section-title" id="cfg-settings-title">On the unit (read by serial)</div>
|
||||||
<div class="dev-table" id="cfg-settings-table"></div>
|
<div class="dev-table" id="cfg-settings-table"></div>
|
||||||
|
<!-- Phase 5: change the unit's settings by serial -- Preview, then Send (audited, read back). -->
|
||||||
|
<div class="cfg-section-title" id="cfg-edit-title" hidden>Change settings on this unit</div>
|
||||||
|
<div class="cfg-grid" id="cfg-edit" hidden></div>
|
||||||
|
<div class="cfg-actions" id="cfg-edit-actions" hidden>
|
||||||
|
<button class="btn btn-ghost" id="cfg-preview-btn" disabled>Preview</button>
|
||||||
|
<button class="btn btn-success" id="cfg-send-btn" disabled>Send to Unit</button>
|
||||||
|
<span id="cfg-edit-note"></span>
|
||||||
|
</div>
|
||||||
|
<div class="dev-table" id="cfg-preview"></div>
|
||||||
|
<div class="dev-table" id="cfg-result"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cfg-grid" id="cfg-form">
|
<div class="cfg-grid" id="cfg-form">
|
||||||
@@ -1129,7 +1139,6 @@
|
|||||||
|
|
||||||
<div class="cfg-actions">
|
<div class="cfg-actions">
|
||||||
<button class="btn btn-ghost" id="cfg-read-btn" onclick="readConfig()" disabled>Read from Device</button>
|
<button class="btn btn-ghost" id="cfg-read-btn" onclick="readConfig()" disabled>Read from Device</button>
|
||||||
<button class="btn btn-success" id="cfg-write-btn" onclick="writeConfig()" disabled>Write to Device</button>
|
|
||||||
<button class="btn btn-ghost" onclick="clearConfigForm()">Clear Form</button>
|
<button class="btn btn-ghost" onclick="clearConfigForm()">Clear Form</button>
|
||||||
<span id="cfg-status"></span>
|
<span id="cfg-status"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const DEVICE_ROUTES = {
|
|||||||
call_home_state: ['GET', '/device/call_home/state', true],
|
call_home_state: ['GET', '/device/call_home/state', true],
|
||||||
call_home_on: ['POST', '/device/call_home/enable', true],
|
call_home_on: ['POST', '/device/call_home/enable', true],
|
||||||
call_home_off: ['POST', '/device/call_home/disable', true],
|
call_home_off: ['POST', '/device/call_home/disable', true],
|
||||||
config_write: ['POST', '/device/config', false],
|
settings_change: ['POST', '/device/settings/change', true],
|
||||||
event_waveform: ['GET', '/device/event/{index}/waveform', false],
|
event_waveform: ['GET', '/device/event/{index}/waveform', false],
|
||||||
event_file: ['GET', '/device/event/{index}/blastware_file', false],
|
event_file: ['GET', '/device/event/{index}/blastware_file', false],
|
||||||
};
|
};
|
||||||
@@ -88,9 +88,9 @@ function controlsFor(unit) {
|
|||||||
// by host, the legacy read is Series 3's; by serial, both series (phase 4)
|
// by host, the legacy read is Series 3's; by serial, both series (phase 4)
|
||||||
callHomeRead: series === 3 || (serialMode && series === 4),
|
callHomeRead: series === 3 || (serialMode && series === 4),
|
||||||
callHomeChange: serialMode && (series === 3 || series === 4),
|
callHomeChange: serialMode && (series === 3 || series === 4),
|
||||||
configWrite: false,
|
configWrite: serialMode && (series === 3 || series === 4),
|
||||||
callHomeWrite: false,
|
callHomeWrite: false,
|
||||||
reasons: { configWrite: 'Coming in phase 5 (#46)',
|
reasons: { configWrite: 'By serial only: Preview, then Send (audited).',
|
||||||
callHomeWrite: 'By serial: use Call-home On / Off (audited). Other call-home fields wait for the THOR round.' },
|
callHomeWrite: 'By serial: use Call-home On / Off (audited). Other call-home fields wait for the THOR round.' },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -101,6 +101,15 @@ function changeSummary(body) {
|
|||||||
const subs = ((body.plan || {}).steps || []).map(s => s.sub).join(', ');
|
const subs = ((body.plan || {}).steps || []).map(s => s.sub).join(', ');
|
||||||
return `${body.action}: dry run — would send ${subs}`;
|
return `${body.action}: dry run — would send ${subs}`;
|
||||||
}
|
}
|
||||||
|
if (body.action === 'change settings') { // phase 5: the state is a read-back verdict
|
||||||
|
if (body.outcome === 'skipped') return 'change settings: the unit already holds these — nothing sent';
|
||||||
|
if (body.outcome === 'sent' && body.verified === 'ok') {
|
||||||
|
return `change settings: confirmed — the unit holds what was sent (audit ${id8})`;
|
||||||
|
}
|
||||||
|
if (body.verified === 'mismatch') {
|
||||||
|
return `change settings: sent, but the unit reads ${body.state_after} — see what it holds (audit ${id8})`;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (body.outcome === 'skipped') return `${body.action}: already ${body.state_before} — nothing sent`;
|
if (body.outcome === 'skipped') return `${body.action}: already ${body.state_before} — nothing sent`;
|
||||||
if (body.outcome === 'sent' && body.verified === 'ok') {
|
if (body.outcome === 'sent' && body.verified === 'ok') {
|
||||||
return `${body.action}: confirmed — ${body.state_before} → ${body.state_after} (audit ${id8})`;
|
return `${body.action}: confirmed — ${body.state_before} → ${body.state_after} (audit ${id8})`;
|
||||||
@@ -209,4 +218,54 @@ function callHomeRows(state) {
|
|||||||
: d.reason || `Unknown (byte 5 = ${d.byte5 ?? '?'})`;
|
: d.reason || `Unknown (byte 5 = ${d.byte5 ?? '?'})`;
|
||||||
return [['Call-home', sw], ['Dial string', s.dial_string || '—'], ['Series', s.series]];
|
return [['Call-home', sw], ['Dial string', s.dial_string || '—'], ['Series', s.series]];
|
||||||
}
|
}
|
||||||
|
// ── The Config tab's edit form, by serial (phase 5) ──────────────────────────
|
||||||
|
|
||||||
|
// The fields the server says this unit can change, in its order, with their
|
||||||
|
// limits (UnitSettings.detail.editable).
|
||||||
|
function settingsFormFields(st) {
|
||||||
|
return (((st || {}).detail || {}).editable || []).map(f => ({ ...f }));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only what the operator changed, typed as the server expects. Numbers compare
|
||||||
|
// as numbers (0.30 is 0.3); a number that does not parse is left out (the
|
||||||
|
// preview shows exactly what would change); read-only fields never count.
|
||||||
|
function settingsChanges(fields, edited) {
|
||||||
|
const out = {};
|
||||||
|
const e = edited || {};
|
||||||
|
for (const f of fields || []) {
|
||||||
|
if (f.readonly || !(f.field in e)) continue;
|
||||||
|
let v = e[f.field];
|
||||||
|
if (f.kind === 'number' || (f.kind === 'choice' && typeof f.value === 'number')) {
|
||||||
|
if (v === '' || v == null) continue;
|
||||||
|
v = Number(v);
|
||||||
|
if (!Number.isFinite(v) || v === Number(f.value)) continue;
|
||||||
|
} else if (f.kind === 'bool') {
|
||||||
|
v = Boolean(v);
|
||||||
|
if (v === Boolean(f.value)) continue;
|
||||||
|
} else {
|
||||||
|
v = String(v);
|
||||||
|
if (v === String(f.value == null ? '' : f.value)) continue;
|
||||||
|
}
|
||||||
|
out[f.field] = v;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
const _dash = v => (v == null || v === '' ? '—' : v);
|
||||||
|
|
||||||
|
// A preview (dry run): one row per field, [label, the unit holds, it would get].
|
||||||
|
function settingsPreviewRows(body) {
|
||||||
|
return Object.values(((body || {}).plan || {}).fields || {}).map(r => [r.label, _dash(r.old), _dash(r.new)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Why a preview would not be sent ('' when nothing blocks it).
|
||||||
|
function settingsBlockedText(body) {
|
||||||
|
return (((body || {}).plan || {}).blocked || []).join('; ');
|
||||||
|
}
|
||||||
|
|
||||||
|
// After a send: [label, the unit held, SFM sent, the unit now holds].
|
||||||
|
function settingsResultRows(body) {
|
||||||
|
const fields = ((((body || {}).detail || {}).snapshot || {}).fields) || {};
|
||||||
|
return Object.values(fields).map(r => [r.label, _dash(r.old), _dash(r.new), _dash(r.now)]);
|
||||||
|
}
|
||||||
/* </device-routing> */
|
/* </device-routing> */
|
||||||
+178
-65
@@ -90,8 +90,7 @@ function applyControls() {
|
|||||||
badge.textContent = series ? `Series ${series}` : '';
|
badge.textContent = series ? `Series ${series}` : '';
|
||||||
document.getElementById('hangup-btn').hidden = !c.hangup;
|
document.getElementById('hangup-btn').hidden = !c.hangup;
|
||||||
setDiagButtonsEnabled(c.diagnostics);
|
setDiagButtonsEnabled(c.diagnostics);
|
||||||
const cw = document.getElementById('cfg-write-btn');
|
updateSettingsButtons();
|
||||||
cw.disabled = !c.configWrite; cw.title = c.reasons.configWrite;
|
|
||||||
const hw = document.getElementById('ch-write-btn');
|
const hw = document.getElementById('ch-write-btn');
|
||||||
hw.disabled = !c.callHomeWrite; hw.title = c.reasons.callHomeWrite;
|
hw.disabled = !c.callHomeWrite; hw.title = c.reasons.callHomeWrite;
|
||||||
const chr = document.getElementById('ch-read-btn');
|
const chr = document.getElementById('ch-read-btn');
|
||||||
@@ -163,18 +162,24 @@ async function changeCallHome(on) {
|
|||||||
await readCallHomeBySerial({ quiet: true });
|
await readCallHomeBySerial({ quiet: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Config tab by serial (#6): settings are read-only until phase 5, so the
|
// The Config tab by serial (#6; phase 5): the settings box shows from the start
|
||||||
// empty legacy edit form stays hidden and the settings box shows from the start.
|
// and the empty legacy form stays hidden. A different unit's settings, form,
|
||||||
// A different unit's settings are never left on screen.
|
// preview or result are never left on screen.
|
||||||
let settingsShownFor = null;
|
let settingsShownFor = null;
|
||||||
|
let settingsShown = null; // the UnitSettings the edit form was built from
|
||||||
|
let settingsPreview = null; // {serial, changes (JSON), revision, blocked}: what a Send would send
|
||||||
function applyConfigPanes() {
|
function applyConfigPanes() {
|
||||||
const serial = normSerial(currentUnit().serial);
|
const serial = normSerial(currentUnit().serial);
|
||||||
const p = serialPanes(Boolean(serial), Boolean(serial) && settingsShownFor === serial);
|
const p = serialPanes(Boolean(serial), Boolean(serial) && settingsShownFor === serial);
|
||||||
document.getElementById('cfg-form').style.display = p.configForm ? '' : 'none';
|
document.getElementById('cfg-form').style.display = p.configForm ? '' : 'none';
|
||||||
document.getElementById('cfg-settings').style.display = p.settingsBox ? 'block' : 'none';
|
document.getElementById('cfg-settings').style.display = p.settingsBox ? 'block' : 'none';
|
||||||
if (p.settingsPlaceholder) {
|
if (p.settingsPlaceholder) {
|
||||||
settingsShownFor = null;
|
settingsShownFor = null; settingsShown = null; settingsPreview = null;
|
||||||
renderTextTable('cfg-settings-table', [['Settings', 'Not read yet — press Read from Device']]);
|
renderTextTable('cfg-settings-table', [['Settings', 'Not read yet — press Read from Device']]);
|
||||||
|
document.getElementById('cfg-settings-title').textContent = 'On the unit (read by serial)';
|
||||||
|
for (const id of ['cfg-edit-title', 'cfg-edit', 'cfg-edit-actions']) document.getElementById(id).hidden = true;
|
||||||
|
renderTextTable('cfg-preview', []);
|
||||||
|
renderTextTable('cfg-result', []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -783,25 +788,185 @@ function clearConfigForm() {
|
|||||||
setCfgStatus('');
|
setCfgStatus('');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serial mode: the shared UnitSettings, read-only (writes wait for phase 5).
|
// Serial mode: the shared UnitSettings, and the form to change them (phase 5).
|
||||||
async function readSettingsBySerial() {
|
// `quiet`: the re-read after a send -- the send's own result stays on screen.
|
||||||
|
async function readSettingsBySerial({ quiet = false } = {}) {
|
||||||
const btn = document.getElementById('cfg-read-btn');
|
const btn = document.getElementById('cfg-read-btn');
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
setCfgStatus('Reading settings from the unit…');
|
if (!quiet) setCfgStatus('Reading settings from the unit…');
|
||||||
try {
|
try {
|
||||||
const st = await deviceFetch('settings');
|
const st = await deviceFetch('settings');
|
||||||
renderTextTable('cfg-settings-table', settingsRows(st));
|
renderTextTable('cfg-settings-table', settingsRows(st));
|
||||||
settingsShownFor = normSerial(st.serial);
|
settingsShownFor = normSerial(st.serial);
|
||||||
|
settingsShown = st;
|
||||||
|
settingsPreview = null;
|
||||||
|
document.getElementById('cfg-settings-title').textContent =
|
||||||
|
`On the unit ${st.serial} — read ${new Date().toTimeString().slice(0, 5)}`;
|
||||||
|
renderSettingsForm(st);
|
||||||
|
renderTextTable('cfg-preview', []);
|
||||||
|
if (!quiet) renderTextTable('cfg-result', []);
|
||||||
document.getElementById('cfg-settings').style.display = 'block';
|
document.getElementById('cfg-settings').style.display = 'block';
|
||||||
document.getElementById('cfg-form').style.display = 'none';
|
document.getElementById('cfg-form').style.display = 'none';
|
||||||
setCfgStatus(`Settings read from ${st.serial}.`, 'ok');
|
if (!quiet) setCfgStatus(`Settings read from ${st.serial}.`, 'ok');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setCfgStatus(`Read failed: ${e.message}`, 'error');
|
if (!quiet) setCfgStatus(`Read failed: ${e.message}`, 'error');
|
||||||
|
else renderTextTable('cfg-preview', [['Re-read', `failed: ${e.message}`]]);
|
||||||
} finally {
|
} finally {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
|
updateSettingsButtons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── Changing settings by serial (phase 5) ─────────────────────────────────────
|
||||||
|
|
||||||
|
function settingsInput(f) {
|
||||||
|
let el;
|
||||||
|
if (f.kind === 'choice') {
|
||||||
|
el = document.createElement('select');
|
||||||
|
for (const c of f.choices || []) {
|
||||||
|
const o = document.createElement('option');
|
||||||
|
o.value = String(c.value); o.textContent = c.label;
|
||||||
|
el.appendChild(o);
|
||||||
|
}
|
||||||
|
el.value = String(f.value);
|
||||||
|
} else if (f.kind === 'bool') {
|
||||||
|
el = document.createElement('input');
|
||||||
|
el.type = 'checkbox'; el.checked = Boolean(f.value);
|
||||||
|
} else {
|
||||||
|
el = document.createElement('input');
|
||||||
|
el.type = f.kind === 'number' ? 'number' : 'text';
|
||||||
|
if (f.kind === 'number') {
|
||||||
|
el.step = f.step != null ? String(f.step) : 'any';
|
||||||
|
if (f.min != null) el.min = String(f.min);
|
||||||
|
if (f.max != null) el.max = String(f.max);
|
||||||
|
}
|
||||||
|
if (f.maxlength) el.maxLength = f.maxlength;
|
||||||
|
el.value = f.value == null ? '' : String(f.value);
|
||||||
|
}
|
||||||
|
el.id = `cfg-f-${f.field}`;
|
||||||
|
el.dataset.field = f.field;
|
||||||
|
el.disabled = Boolean(f.readonly);
|
||||||
|
if (f.readonly) el.title = 'Shown, not changed yet';
|
||||||
|
el.addEventListener(f.kind === 'text' || f.kind === 'number' ? 'input' : 'change', settingsEdited);
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderSettingsForm(st) {
|
||||||
|
const box = document.getElementById('cfg-edit');
|
||||||
|
box.innerHTML = '';
|
||||||
|
for (const f of settingsFormFields(st)) {
|
||||||
|
const wrap = document.createElement('div');
|
||||||
|
wrap.className = 'cfg-field';
|
||||||
|
const label = document.createElement('label');
|
||||||
|
label.textContent = f.unit ? `${f.label} (${f.unit})` : f.label;
|
||||||
|
label.htmlFor = `cfg-f-${f.field}`;
|
||||||
|
wrap.append(label, settingsInput(f));
|
||||||
|
box.appendChild(wrap);
|
||||||
|
}
|
||||||
|
for (const id of ['cfg-edit-title', 'cfg-edit', 'cfg-edit-actions']) document.getElementById(id).hidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editedSettings() {
|
||||||
|
const out = {};
|
||||||
|
for (const el of document.querySelectorAll('#cfg-edit [data-field]')) {
|
||||||
|
out[el.dataset.field] = el.type === 'checkbox' ? el.checked : el.value;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function currentSettingsChanges() {
|
||||||
|
return settingsShown ? settingsChanges(settingsFormFields(settingsShown), editedSettings()) : {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Any edit after a preview: the preview no longer covers what Send would send.
|
||||||
|
function settingsEdited() {
|
||||||
|
settingsPreview = null;
|
||||||
|
renderTextTable('cfg-preview', []);
|
||||||
|
updateSettingsButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSettingsButtons() {
|
||||||
|
const c = controlsFor(currentUnit());
|
||||||
|
const serial = normSerial(currentUnit().serial);
|
||||||
|
const shown = Boolean(settingsShown) && normSerial(settingsShown.serial) === serial;
|
||||||
|
const changes = shown ? currentSettingsChanges() : {};
|
||||||
|
const preview = document.getElementById('cfg-preview-btn');
|
||||||
|
preview.disabled = !(c.configWrite && shown && Object.keys(changes).length) || changeInFlight;
|
||||||
|
preview.title = c.reasons.configWrite;
|
||||||
|
const ready = Boolean(settingsPreview) && settingsPreview.serial === serial && !settingsPreview.blocked
|
||||||
|
&& settingsPreview.changes === JSON.stringify(changes);
|
||||||
|
document.getElementById('cfg-send-btn').disabled = !(c.configWrite && ready) || changeInFlight;
|
||||||
|
}
|
||||||
|
|
||||||
|
function postSettingsChange(changes, { dryRun, revision }) {
|
||||||
|
return deviceRequest('settings_change', dryRun ? { dry_run: 'true' } : {}, {
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify(revision ? { changes, revision } : { changes }),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// A dry run: SFM re-reads the unit and says what would change. Nothing is sent.
|
||||||
|
async function previewSettings() {
|
||||||
|
const changes = currentSettingsChanges();
|
||||||
|
const serial = normSerial(currentUnit().serial);
|
||||||
|
renderTextTable('cfg-result', []);
|
||||||
|
setCfgStatus('Previewing — reading the unit…');
|
||||||
|
try {
|
||||||
|
const r = await postSettingsChange(changes, { dryRun: true });
|
||||||
|
const body = await r.json().catch(() => ({}));
|
||||||
|
if (!r.ok) {
|
||||||
|
setCfgStatus(changeErrorText('Preview', r.status, body, currentUnit(), r.statusText), 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const blocked = settingsBlockedText(body);
|
||||||
|
renderTextTable('cfg-preview', [
|
||||||
|
...settingsPreviewRows(body).map(([label, old, now]) => [label, `${old} → ${now}`]),
|
||||||
|
...((body.plan || {}).warnings || []).map(w => ['Note', w]),
|
||||||
|
...(blocked ? [['Will not send', blocked]] : []),
|
||||||
|
]);
|
||||||
|
settingsPreview = { serial, changes: JSON.stringify(changes), revision: (body.plan || {}).revision,
|
||||||
|
blocked: Boolean(blocked) };
|
||||||
|
setCfgStatus(blocked ? 'Preview: this change cannot be sent (see above). Nothing was sent.'
|
||||||
|
: 'Preview ready — nothing sent yet. Check it, then Send to Unit.',
|
||||||
|
blocked ? 'error' : 'ok');
|
||||||
|
} catch (e) {
|
||||||
|
setCfgStatus(`Preview failed: ${e.message}`, 'error');
|
||||||
|
} finally {
|
||||||
|
updateSettingsButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// One audited send, never retried; the body says what the unit now holds.
|
||||||
|
async function sendSettings() {
|
||||||
|
const p = settingsPreview;
|
||||||
|
if (!p) return;
|
||||||
|
const changes = JSON.parse(p.changes);
|
||||||
|
const names = settingsFormFields(settingsShown).filter(f => f.field in changes).map(f => f.label);
|
||||||
|
if (!confirm(`Send these changes to ${p.serial}?\n\n${names.join('\n')}`)) return;
|
||||||
|
changeInFlight = true; applyControls();
|
||||||
|
setCfgStatus(`Sending to ${p.serial}…`);
|
||||||
|
let body = {};
|
||||||
|
try {
|
||||||
|
const r = await postSettingsChange(changes, { dryRun: false, revision: p.revision });
|
||||||
|
body = await r.json().catch(() => ({}));
|
||||||
|
if (body.outcome) {
|
||||||
|
renderTextTable('cfg-result', settingsResultRows(body).map(
|
||||||
|
([label, old, sent, now]) => [label, `${old} → ${sent} · the unit now holds ${now}`]));
|
||||||
|
setCfgStatus(changeSummary(body), r.ok ? 'ok' : 'error');
|
||||||
|
} else {
|
||||||
|
setCfgStatus(changeErrorText('Change settings', r.status, body, currentUnit(), r.statusText), 'error');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// No reply is not "nothing sent": the request may have reached the unit.
|
||||||
|
setCfgStatus(`Change settings: no reply from SFM (${e.message}) — it may have been sent; `
|
||||||
|
+ 'read the unit\'s settings and GET /db/device_commands', 'error');
|
||||||
|
}
|
||||||
|
settingsPreview = null;
|
||||||
|
renderTextTable('cfg-preview', []);
|
||||||
|
changeInFlight = false; applyControls();
|
||||||
|
if (body.outcome) await readSettingsBySerial({ quiet: true });
|
||||||
|
}
|
||||||
|
|
||||||
async function readConfig() {
|
async function readConfig() {
|
||||||
if (!devHost()) { setCfgStatus('Not connected.', 'error'); return; }
|
if (!devHost()) { setCfgStatus('Not connected.', 'error'); return; }
|
||||||
if (serialMode()) { await readSettingsBySerial(); return; }
|
if (serialMode()) { await readSettingsBySerial(); return; }
|
||||||
@@ -822,60 +987,6 @@ async function readConfig() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function writeConfig() {
|
|
||||||
if (!devHost()) { setCfgStatus('Not connected.', 'error'); return; }
|
|
||||||
|
|
||||||
// Build body — only include fields that have values
|
|
||||||
const body = {};
|
|
||||||
const rm = qs('cfg-recording-mode').value;
|
|
||||||
if (rm !== '') body.recording_mode = parseInt(rm, 10);
|
|
||||||
const sr = qs('cfg-sample-rate').value;
|
|
||||||
if (sr) body.sample_rate = parseInt(sr, 10);
|
|
||||||
const hi = qs('cfg-histogram-interval').value;
|
|
||||||
if (hi !== '') body.histogram_interval_sec = parseInt(hi, 10);
|
|
||||||
const rt = qs('cfg-record-time').value;
|
|
||||||
if (rt) body.record_time = parseFloat(rt);
|
|
||||||
const trig = qs('cfg-trigger').value;
|
|
||||||
if (trig) body.trigger_level_geo = parseFloat(trig);
|
|
||||||
const alarm = qs('cfg-alarm').value;
|
|
||||||
if (alarm) body.alarm_level_geo = parseFloat(alarm);
|
|
||||||
const gr = qs('cfg-geo-range').value;
|
|
||||||
if (gr !== '') body.geo_range = parseInt(gr, 10);
|
|
||||||
const proj = qs('cfg-project').value.trim();
|
|
||||||
if (proj) body.project = proj;
|
|
||||||
const cli = qs('cfg-client').value.trim();
|
|
||||||
if (cli) body.client_name = cli;
|
|
||||||
const op = qs('cfg-operator').value.trim();
|
|
||||||
if (op) body.operator = op;
|
|
||||||
const sl = qs('cfg-seis-loc').value.trim();
|
|
||||||
if (sl) body.seis_loc = sl;
|
|
||||||
const notes = qs('cfg-notes').value.trim();
|
|
||||||
if (notes) body.notes = notes;
|
|
||||||
|
|
||||||
if (Object.keys(body).length === 0) {
|
|
||||||
setCfgStatus('No fields to write — fill in at least one field.', 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fieldsStr = Object.keys(body).join(', ');
|
|
||||||
setCfgStatus(`Writing ${Object.keys(body).length} field(s)…`);
|
|
||||||
document.getElementById('cfg-write-btn').disabled = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await deviceFetch('config_write', {}, {
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify(body),
|
|
||||||
});
|
|
||||||
setCfgStatus(`Written: ${fieldsStr}`, 'ok');
|
|
||||||
// Re-read device info so Device tab and bar refresh
|
|
||||||
await readConfig();
|
|
||||||
} catch(e) {
|
|
||||||
setCfgStatus(`Write failed: ${e.message}`, 'error');
|
|
||||||
} finally {
|
|
||||||
document.getElementById('cfg-write-btn').disabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ── Call Home form ─────────────────────────────────────────────────────────────
|
// ── Call Home form ─────────────────────────────────────────────────────────────
|
||||||
function setChStatus(msg, type) {
|
function setChStatus(msg, type) {
|
||||||
const el = document.getElementById('ch-status');
|
const el = document.getElementById('ch-status');
|
||||||
@@ -2339,6 +2450,8 @@ for (const id of ['dev-serial', 'dev-host', 'dev-port']) {
|
|||||||
// New controls are wired here, not with onclick= in the HTML (no inline JS).
|
// New controls are wired here, not with onclick= in the HTML (no inline JS).
|
||||||
document.getElementById('ch-on-btn').addEventListener('click', () => changeCallHome(true));
|
document.getElementById('ch-on-btn').addEventListener('click', () => changeCallHome(true));
|
||||||
document.getElementById('ch-off-btn').addEventListener('click', () => changeCallHome(false));
|
document.getElementById('ch-off-btn').addEventListener('click', () => changeCallHome(false));
|
||||||
|
document.getElementById('cfg-preview-btn').addEventListener('click', previewSettings);
|
||||||
|
document.getElementById('cfg-send-btn').addEventListener('click', sendSettings);
|
||||||
applyControls();
|
applyControls();
|
||||||
|
|
||||||
// Reflect any persisted mic-unit preference in the header pill on load
|
// Reflect any persisted mic-unit preference in the header pill on load
|
||||||
|
|||||||
+39
-3
@@ -30,6 +30,7 @@ Roles:
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import pickle
|
import pickle
|
||||||
import re
|
import re
|
||||||
@@ -46,7 +47,19 @@ from sfm.shape_metrics import shape_from_h5, offset_from_h5
|
|||||||
|
|
||||||
log = logging.getLogger("sfm.waveform_store")
|
log = logging.getLogger("sfm.waveform_store")
|
||||||
|
|
||||||
A5_PICKLE_VERSION = 1
|
# 2 (2026-11-06, #58): frames as the parser gives them since an escaped checksum
|
||||||
|
# stopped leaving its 0x10 in `data`. A version-1 frame with a checksum of 02, 03
|
||||||
|
# or 04 still ends in that 0x10; load_a5 drops it (_frame_from_v1).
|
||||||
|
A5_PICKLE_VERSION = 2
|
||||||
|
|
||||||
|
|
||||||
|
def _frame_from_v1(f: S3Frame) -> S3Frame:
|
||||||
|
"""A frame pickled before #58, as the parser reads its reply now. Its 02/03/04
|
||||||
|
checksum arrived as `10 X` (every recorded one did), and the 10 ended `data`."""
|
||||||
|
if f.chk_byte in (0x02, 0x03, 0x04) and f.data[-1:] == b"\x10":
|
||||||
|
return S3Frame(sub=f.sub, page_hi=f.page_hi, page_lo=f.page_lo, data=f.data[:-1],
|
||||||
|
checksum_valid=f.checksum_valid, chk_byte=f.chk_byte)
|
||||||
|
return f
|
||||||
|
|
||||||
|
|
||||||
def _frame_to_dict(f: S3Frame) -> dict:
|
def _frame_to_dict(f: S3Frame) -> dict:
|
||||||
@@ -93,6 +106,25 @@ class WaveformStore:
|
|||||||
d.mkdir(parents=True, exist_ok=True)
|
d.mkdir(parents=True, exist_ok=True)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
def save_mlg(self, serial: Optional[str], file_name: str, data: bytes) -> str:
|
||||||
|
"""Keep an original .MLG byte for byte, at <serial or _unresolved>/mlg/<file_name>.
|
||||||
|
|
||||||
|
Blastware reuses some names (a cable download is always <serial>.MLG), so
|
||||||
|
a name already holding different bytes gets the hash in its name instead.
|
||||||
|
Returns the path relative to the store root. Raises ValueError for a
|
||||||
|
serial that is not plain letters and digits (it becomes a directory)."""
|
||||||
|
if serial is not None and not re.fullmatch(r"[A-Za-z0-9]{1,16}", serial):
|
||||||
|
raise ValueError(f"not a plain serial: {serial!r}")
|
||||||
|
d = self.root / (serial or "_unresolved") / "mlg"
|
||||||
|
d.mkdir(parents=True, exist_ok=True)
|
||||||
|
path = d / Path(file_name).name
|
||||||
|
if path.exists() and path.read_bytes() != data:
|
||||||
|
digest = hashlib.sha256(data).hexdigest()[:8]
|
||||||
|
path = d / f"{path.stem}.{digest}{path.suffix}"
|
||||||
|
if not path.exists():
|
||||||
|
path.write_bytes(data)
|
||||||
|
return path.relative_to(self.root).as_posix()
|
||||||
|
|
||||||
def paths_for(self, serial: str, filename: str) -> tuple[Path, Path]:
|
def paths_for(self, serial: str, filename: str) -> tuple[Path, Path]:
|
||||||
"""Return (blastware_path, a5_pickle_path) for a given serial+filename.
|
"""Return (blastware_path, a5_pickle_path) for a given serial+filename.
|
||||||
|
|
||||||
@@ -801,7 +833,8 @@ class WaveformStore:
|
|||||||
|
|
||||||
def load_a5(self, serial: str, filename: str) -> Optional[list[S3Frame]]:
|
def load_a5(self, serial: str, filename: str) -> Optional[list[S3Frame]]:
|
||||||
"""
|
"""
|
||||||
Re-hydrate the pickled A5 frame stream for a stored event.
|
Re-hydrate the pickled A5 frame stream for a stored event, as the parser
|
||||||
|
reads it now (a version-1 pickle's frames are converted).
|
||||||
Returns None if the sidecar is missing.
|
Returns None if the sidecar is missing.
|
||||||
"""
|
"""
|
||||||
_, a5_path = self.paths_for(serial, filename)
|
_, a5_path = self.paths_for(serial, filename)
|
||||||
@@ -812,7 +845,10 @@ class WaveformStore:
|
|||||||
if not isinstance(payload, dict) or "frames" not in payload:
|
if not isinstance(payload, dict) or "frames" not in payload:
|
||||||
log.warning("WaveformStore.load_a5: malformed sidecar at %s", a5_path)
|
log.warning("WaveformStore.load_a5: malformed sidecar at %s", a5_path)
|
||||||
return None
|
return None
|
||||||
return [_dict_to_frame(d) for d in payload["frames"]]
|
frames = [_dict_to_frame(d) for d in payload["frames"]]
|
||||||
|
if payload.get("version", 1) < 2:
|
||||||
|
frames = [_frame_from_v1(f) for f in frames]
|
||||||
|
return frames
|
||||||
|
|
||||||
# ── modern .sfm.json sidecar accessors ──────────────────────────────────────
|
# ── modern .sfm.json sidecar accessors ──────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,59 @@ from minimateplus.models import ComplianceConfig, DeviceInfo, Event, MonitorStat
|
|||||||
|
|
||||||
SETUP_FIXTURE = Path(__file__).parent / "fixtures" / "micromate-setup" / "um20147_baseline.bin"
|
SETUP_FIXTURE = Path(__file__).parent / "fixtures" / "micromate-setup" / "um20147_baseline.bin"
|
||||||
THOR_IDF = Path(__file__).parent / "fixtures" / "thor-idf"
|
THOR_IDF = Path(__file__).parent / "fixtures" / "thor-idf"
|
||||||
|
PUSH_FIXTURE = Path(__file__).parent / "fixtures" / "micromate-writes" / "setup-push-overwrite-test1.json"
|
||||||
|
|
||||||
|
|
||||||
|
def s4_push_reads() -> dict:
|
||||||
|
"""UM12947's reads (content, by SUB) just before THOR's setup push: 0x08 prefs,
|
||||||
|
0x2E trigger, 0x1A setup, 0x41 active name."""
|
||||||
|
import json
|
||||||
|
ex = json.loads(PUSH_FIXTURE.read_text())["exchanges"]
|
||||||
|
start = next(i for i, e in enumerate(ex) if e["sub"] == 0xDA)
|
||||||
|
return {e["sub"]: bytes.fromhex(e["response_data"])[11:] for e in ex[:start]}
|
||||||
|
|
||||||
|
|
||||||
|
_S3_BLOCKS = None
|
||||||
|
|
||||||
|
|
||||||
|
def s3_settings_blocks() -> dict:
|
||||||
|
"""BE9441's four settings blocks on 2026-10-26, as SFM's reads return them:
|
||||||
|
the 1A read Blastware took right after its second write (assembled, 2,090 B),
|
||||||
|
and the event index / trigger / waveform blocks that write sent back (each a
|
||||||
|
write is the read plus two bytes)."""
|
||||||
|
global _S3_BLOCKS
|
||||||
|
if _S3_BLOCKS is None:
|
||||||
|
from minimateplus.framing import S3FrameParser
|
||||||
|
from minimateplus.protocol import assemble_compliance_content
|
||||||
|
from test_minimate_write_frames import WRITES, _payload
|
||||||
|
fix = Path(__file__).parent / "fixtures" / "minimate-bench-10-26-26-histogram"
|
||||||
|
reads, cur = [], None
|
||||||
|
for f in S3FrameParser().feed((fix / "unit_replies.bin").read_bytes()):
|
||||||
|
if f.sub != 0xE5:
|
||||||
|
continue
|
||||||
|
if len(f.data) == 11:
|
||||||
|
cur = []
|
||||||
|
reads.append(cur)
|
||||||
|
else:
|
||||||
|
cur.append(bytes(f.data))
|
||||||
|
sent = {_payload(f)[2]: _payload(f)[16:] for f in WRITES[13:26]}
|
||||||
|
_S3_BLOCKS = {"event_index": sent[0x68][:-2], "compliance": assemble_compliance_content(reads[2]),
|
||||||
|
"trigger": sent[0x82][:-2], "waveform": sent[0x69][:-2]}
|
||||||
|
return dict(_S3_BLOCKS)
|
||||||
|
|
||||||
|
|
||||||
|
def s3_device_info_answer(serial: bytes = b"BE9441") -> bytes:
|
||||||
|
"""What a MONITORING MiniMate returns for a 1A read, assembled: its device-info
|
||||||
|
block (BE9441 10-26: reads 3-7 start 0e 'BE9441'), 2,090 bytes."""
|
||||||
|
return (b"\x0e" + serial).ljust(2090, b"\x00")
|
||||||
|
|
||||||
|
|
||||||
|
def schedule_record(time_slot: int, action: int, setup: str = "") -> bytes:
|
||||||
|
"""One 260-byte schedule.dat record (micromate.schedule's layout)."""
|
||||||
|
rec = bytearray(260)
|
||||||
|
rec[4], rec[5], rec[6], rec[7] = time_slot, 3, action, len(setup)
|
||||||
|
rec[8:8 + len(setup)] = setup.encode("ascii")
|
||||||
|
return bytes(rec)
|
||||||
THOR_WRITES = Path(__file__).parent / "fixtures" / "micromate-writes"
|
THOR_WRITES = Path(__file__).parent / "fixtures" / "micromate-writes"
|
||||||
|
|
||||||
|
|
||||||
@@ -97,9 +150,13 @@ def default_s3_events():
|
|||||||
class FakeMiniMateClient(_Base):
|
class FakeMiniMateClient(_Base):
|
||||||
def __init__(self, serial="BE18193", *, monitoring=False, compliance="default", events=None,
|
def __init__(self, serial="BE18193", *, monitoring=False, compliance="default", events=None,
|
||||||
monitor_states=None, write_error=None, serial_reported=None, wake_errors=None,
|
monitor_states=None, write_error=None, serial_reported=None, wake_errors=None,
|
||||||
bare_requests_ignored=False, call_home_raw=None, **kw):
|
bare_requests_ignored=False, call_home_raw=None, settings_blocks=None,
|
||||||
|
monitoring_settings=False, **kw):
|
||||||
super().__init__(**kw)
|
super().__init__(**kw)
|
||||||
self.serial = serial
|
self.serial = serial
|
||||||
|
self.settings_blocks = s3_settings_blocks() if settings_blocks is None else dict(settings_blocks)
|
||||||
|
self.monitoring_settings = monitoring_settings
|
||||||
|
self.pushed = None
|
||||||
# As a monitoring MiniMate (measured 2026-04-08): on a fresh connection a
|
# As a monitoring MiniMate (measured 2026-04-08): on a fresh connection a
|
||||||
# read before SESSION_RESET + POLL goes unanswered. Off unless a test asks.
|
# read before SESSION_RESET + POLL goes unanswered. Off unless a test asks.
|
||||||
self.bare_requests_ignored = bare_requests_ignored
|
self.bare_requests_ignored = bare_requests_ignored
|
||||||
@@ -165,6 +222,23 @@ class FakeMiniMateClient(_Base):
|
|||||||
self._write("call_home")
|
self._write("call_home")
|
||||||
self.call_home_raw = bytes(image) # read back as the unit would store it
|
self.call_home_raw = bytes(image) # read back as the unit would store it
|
||||||
|
|
||||||
|
def read_compliance_content(self) -> bytes:
|
||||||
|
self._bare_read("read_compliance_content")
|
||||||
|
return s3_device_info_answer() if self.monitoring_settings else self.settings_blocks["compliance"]
|
||||||
|
|
||||||
|
def read_settings_blocks(self) -> dict:
|
||||||
|
self._bare_read("read_settings_blocks")
|
||||||
|
blocks = dict(self.settings_blocks)
|
||||||
|
if self.monitoring_settings:
|
||||||
|
blocks["compliance"] = s3_device_info_answer()
|
||||||
|
return blocks
|
||||||
|
|
||||||
|
def push_config_raw(self, event_index, compliance, trigger, waveform, *, escaped=False) -> None:
|
||||||
|
self.pushed_escaped = escaped
|
||||||
|
self.pushed = (bytes(event_index), bytes(compliance), bytes(trigger), bytes(waveform))
|
||||||
|
self._write("push_config_raw")
|
||||||
|
self.settings_blocks["compliance"] = bytes(compliance)[:2090] # read back as the unit stores it
|
||||||
|
|
||||||
def get_monitor_status(self) -> MonitorStatus:
|
def get_monitor_status(self) -> MonitorStatus:
|
||||||
self._bare_read("get_monitor_status")
|
self._bare_read("get_monitor_status")
|
||||||
state = self.monitor_states.pop(0) if len(self.monitor_states) > 1 else self.monitor_states[0]
|
state = self.monitor_states.pop(0) if len(self.monitor_states) > 1 else self.monitor_states[0]
|
||||||
@@ -269,6 +343,10 @@ class _FakeProtocol:
|
|||||||
old = self._owner.call_home
|
old = self._owner.call_home
|
||||||
self._owner.call_home = bytes(st.data[:118]) + bytes(~b & 0xFF for b in old[118:120]) \
|
self._owner.call_home = bytes(st.data[:118]) + bytes(~b & 0xFF for b in old[118:120]) \
|
||||||
+ bytes(st.data[120:])
|
+ bytes(st.data[120:])
|
||||||
|
if st.sub == 0x71: # the unit stores the setup and computes its own CRC
|
||||||
|
from micromate.setup_block import with_crc
|
||||||
|
old = self._owner.setup
|
||||||
|
self._owner.setup = with_crc(old[:3] + bytes(st.data[3:2090]) + old[2090:2092])
|
||||||
return [type("Ack", (), {"sub": s.ack_sub, "data": bytes(11)})() for s in plan.steps]
|
return [type("Ack", (), {"sub": s.ack_sub, "data": bytes(11)})() for s in plan.steps]
|
||||||
|
|
||||||
def read_call_home_config(self):
|
def read_call_home_config(self):
|
||||||
@@ -279,10 +357,20 @@ class _FakeProtocol:
|
|||||||
class FakeMicromateClient(_Base):
|
class FakeMicromateClient(_Base):
|
||||||
def __init__(self, serial="UM20147", *, monitoring=False, events=5,
|
def __init__(self, serial="UM20147", *, monitoring=False, events=5,
|
||||||
unsolicited=b"", event_refs=None, run_states=None,
|
unsolicited=b"", event_refs=None, run_states=None,
|
||||||
serial_reported=None, execute_error=None, call_home=None, **kw):
|
serial_reported=None, execute_error=None, call_home=None, setup=None,
|
||||||
|
prefs=None, trigger=None, active_name=None, schedule_body=None,
|
||||||
|
schedule_error=None, **kw):
|
||||||
super().__init__(**kw)
|
super().__init__(**kw)
|
||||||
self.unit_serial = serial # not `serial`: that is the client's method
|
self.unit_serial = serial # not `serial`: that is the client's method
|
||||||
self.call_home = um12947_call_home() if call_home is None else call_home
|
self.call_home = um12947_call_home() if call_home is None else call_home
|
||||||
|
push = s4_push_reads()
|
||||||
|
self.setup = SETUP_FIXTURE.read_bytes()[11:] if setup is None else setup
|
||||||
|
self.prefs = push[0x08] if prefs is None else prefs
|
||||||
|
self.trigger = push[0x2E] if trigger is None else trigger
|
||||||
|
self.active_name = (push[0x41].split(b"\x00")[0].decode("ascii")
|
||||||
|
if active_name is None else active_name)
|
||||||
|
self.schedule_body = bytes(524) if schedule_body is None else schedule_body
|
||||||
|
self.schedule_error = schedule_error
|
||||||
self.run_states = list(run_states) if run_states else [0x00]
|
self.run_states = list(run_states) if run_states else [0x00]
|
||||||
self.serial_reported = serial if serial_reported is None else serial_reported
|
self.serial_reported = serial if serial_reported is None else serial_reported
|
||||||
self.execute_error = execute_error
|
self.execute_error = execute_error
|
||||||
@@ -334,7 +422,29 @@ class FakeMicromateClient(_Base):
|
|||||||
|
|
||||||
def get_setup(self):
|
def get_setup(self):
|
||||||
self._step("get_setup")
|
self._step("get_setup")
|
||||||
return decode_setup(SETUP_FIXTURE.read_bytes()[11:])
|
return decode_setup(self.setup)
|
||||||
|
|
||||||
|
def get_setup_content(self) -> bytes:
|
||||||
|
self._step("get_setup_content")
|
||||||
|
return self.setup
|
||||||
|
|
||||||
|
def get_prefs_content(self) -> bytes:
|
||||||
|
self._step("get_prefs_content")
|
||||||
|
return self.prefs
|
||||||
|
|
||||||
|
def get_trigger_content(self) -> bytes:
|
||||||
|
self._step("get_trigger_content")
|
||||||
|
return self.trigger
|
||||||
|
|
||||||
|
def get_active_setup_raw(self) -> str:
|
||||||
|
self._step("get_active_setup_raw")
|
||||||
|
return self.active_name
|
||||||
|
|
||||||
|
def read_schedule(self) -> bytes:
|
||||||
|
self._step("read_schedule")
|
||||||
|
if self.schedule_error is not None:
|
||||||
|
raise self.schedule_error
|
||||||
|
return self.schedule_body
|
||||||
|
|
||||||
def read_unsolicited(self) -> bytes:
|
def read_unsolicited(self) -> bytes:
|
||||||
self._step("read_unsolicited")
|
self._step("read_unsolicited")
|
||||||
|
|||||||
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE18190</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>T190LD42.T00H</FileName>
|
||||||
|
<HistogramStartTime>13:29:24</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2025-12-08</HistogramStartDate>
|
||||||
|
<HistogramStopTime>13:29:37</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2025-12-08</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>2048 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.7 Volts</BatteryLevel>
|
||||||
|
<Calibration>June 13, 2025 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>I-80-North Fork-Area 3-462Richardsvilel</Project>
|
||||||
|
<Client>Fay Company</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc.- Harrison</UserName>
|
||||||
|
<SeisLoc>Loc #8 - Area 3- 462 Richardsville Road</SeisLoc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>1.280</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>2.615</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>1.120</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>15.5</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>64</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>17.7</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>13:29:37</TranPeakTime>
|
||||||
|
<TranPeakDate>2025-12-08</TranPeakDate>
|
||||||
|
<VertPeakTime>13:29:37</VertPeakTime>
|
||||||
|
<VertPeakDate>2025-12-08</VertPeakDate>
|
||||||
|
<LongPeakTime>13:29:37</LongPeakTime>
|
||||||
|
<LongPeakDate>2025-12-08</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>2.644</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>13:29:37</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2025-12-08</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>107.0</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>13:29:37</MicLTime>
|
||||||
|
<MicLDate>2025-12-08</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>51</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.4 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>4.2</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.6 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.4</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.3 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>3.7</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Check</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2025-12-08 13:29:23 - 2025-12-08 13:29:37 "Event Recorded Modem Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2025-12-08 13:29:37</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>1.280</Cell><Cell>15.5</Cell><Cell>2.615</Cell><Cell>64</Cell><Cell>1.120</Cell><Cell>17.7</Cell><Cell>2.644</Cell><Cell>0.001</Cell><Cell>107.0</Cell><Cell>51</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE18190</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>T190LD5Q.LD0H</FileName>
|
||||||
|
<HistogramStartTime>11:00:49</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2025-12-09</HistogramStartDate>
|
||||||
|
<HistogramStopTime>11:00:59</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2025-12-09</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.9 Volts</BatteryLevel>
|
||||||
|
<Calibration>June 13, 2025 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>I-80-North Fork-Area 3-462Richardsvilel</Project>
|
||||||
|
<Client>Fay Company</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc.- Harrison</UserName>
|
||||||
|
<SeisLoc>Loc #8 - Area 3- 462 Richardsville Road</SeisLoc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>2.140</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>OORANGE</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>2.830</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>85</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>34</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>11:00:59</TranPeakTime>
|
||||||
|
<TranPeakDate>2025-12-09</TranPeakDate>
|
||||||
|
<VertPeakTime>11:00:59</VertPeakTime>
|
||||||
|
<VertPeakDate>2025-12-09</VertPeakDate>
|
||||||
|
<LongPeakTime>11:00:59</LongPeakTime>
|
||||||
|
<LongPeakDate>2025-12-09</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>OORANGE</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>11:00:59</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2025-12-09</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>106.0</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>11:00:59</MicLTime>
|
||||||
|
<MicLDate>2025-12-09</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>85</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.4 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>4.4</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.6 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.5</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.3 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>3.9</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>20.5 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>691 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Passed</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2025-12-09 11:00:48 - 2025-12-09 11:00:59 "Event Recorded Modem Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2025-12-09 11:00:59</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>2.140</Cell><Cell>>100</Cell><Cell>OORANGE</Cell><Cell>85</Cell><Cell>2.830</Cell><Cell>34</Cell><Cell>OORANGE</Cell><Cell>0.001</Cell><Cell>106.0</Cell><Cell>85</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+2264
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+10116
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+2100
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+13191
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+2498
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE9559</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>K559HCQ7.IU0H</FileName>
|
||||||
|
<HistogramStartTime>17:06:30</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2018-04-02</HistogramStartDate>
|
||||||
|
<HistogramStopTime>17:07:47</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2018-04-02</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.8 Volts</BatteryLevel>
|
||||||
|
<Calibration>July 24, 2017 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>JV 254</Project>
|
||||||
|
<Client>Walsh Granite JV</Client>
|
||||||
|
<UserName>TMI- DB</UserName>
|
||||||
|
<Seis.Loc>Keim Chevrolet</Seis.Loc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>0.005</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>0.005</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>0.005</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>17:07:30</TranPeakTime>
|
||||||
|
<TranPeakDate>2018-04-02</TranPeakDate>
|
||||||
|
<VertPeakTime>17:07:30</VertPeakTime>
|
||||||
|
<VertPeakDate>2018-04-02</VertPeakDate>
|
||||||
|
<LongPeakTime>17:07:30</LongPeakTime>
|
||||||
|
<LongPeakDate>2018-04-02</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>0.007</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>17:07:30</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2018-04-02</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>88.0</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>17:07:30</MicLTime>
|
||||||
|
<MicLDate>2018-04-02</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.7 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>3.8</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.6 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.5</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.5 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>4.3</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>20.1 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>589 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Passed</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2018-04-02 17:06:30 - 2018-04-02 17:07:47 "Event Recorded Remote Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2018-04-02 17:07:30</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.007</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE18189</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>T189INWA.060H</FileName>
|
||||||
|
<HistogramStartTime>16:04:54</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2020-10-05</HistogramStartDate>
|
||||||
|
<HistogramStopTime>16:06:09</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2020-10-05</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.8 Volts</BatteryLevel>
|
||||||
|
<Calibration>August 25, 2020 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>CMU-New Scaife Hall- Porter Hall</Project>
|
||||||
|
<Client>PJ Dick Inc.</Client>
|
||||||
|
<UserName>Terra-Mechanics, Inc. - D. Harrison</UserName>
|
||||||
|
<Seis.Loc.>Loc. 3 - Porter Hall</Seis.Loc.>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>0.005</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>0.005</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>0.005</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>N/A</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>16:05:54</TranPeakTime>
|
||||||
|
<TranPeakDate>2020-10-05</TranPeakDate>
|
||||||
|
<VertPeakTime>16:05:54</VertPeakTime>
|
||||||
|
<VertPeakDate>2020-10-05</VertPeakDate>
|
||||||
|
<LongPeakTime>16:05:54</LongPeakTime>
|
||||||
|
<LongPeakDate>2020-10-05</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>0.009</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>16:05:54</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2020-10-05</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>106.5</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>16:05:54</MicLTime>
|
||||||
|
<MicLDate>2020-10-05</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>73</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.6 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>3.7</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.6 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.5</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.4 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>4.1</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Check</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2020-10-05 16:04:53 - 2020-10-05 16:06:09 "Event Recorded Keyboard Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2020-10-05 16:05:54</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>N/A</Cell><Cell>0.009</Cell><Cell>0.001</Cell><Cell>106.5</Cell><Cell>73</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE18189</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>T189JZY7.L60H</FileName>
|
||||||
|
<HistogramStartTime>20:00:42</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2023-04-27</HistogramStartDate>
|
||||||
|
<HistogramStopTime>20:01:42</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2023-04-27</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.8 Volts</BatteryLevel>
|
||||||
|
<Calibration>February 21, 2023 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>I-70 at SR 51-75978 - Loc 1 - 4256 SR51</Project>
|
||||||
|
<Client>Golden Triangle</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc. - B. Harrison</UserName>
|
||||||
|
<SeisLoc>Location #1 - 4256 SR 51 - Intec</SeisLoc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>0.015</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>0.020</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>0.015</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>N/A</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>14</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>N/A</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>20:01:42</TranPeakTime>
|
||||||
|
<TranPeakDate>2023-04-27</TranPeakDate>
|
||||||
|
<VertPeakTime>20:01:42</VertPeakTime>
|
||||||
|
<VertPeakDate>2023-04-27</VertPeakDate>
|
||||||
|
<LongPeakTime>20:01:42</LongPeakTime>
|
||||||
|
<LongPeakDate>2023-04-27</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>0.027</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>20:01:42</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2023-04-27</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>91.5</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>20:01:42</MicLTime>
|
||||||
|
<MicLDate>2023-04-27</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>N/A</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.6 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>3.8</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.6 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.5</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.5 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>4.0</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>19.7 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>577 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Passed</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2023-04-27 20:00:41 - 2023-04-27 20:01:42 "Event Recorded Battery Low Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2023-04-27 20:01:42</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.015</Cell><Cell>N/A</Cell><Cell>0.020</Cell><Cell>14</Cell><Cell>0.015</Cell><Cell>N/A</Cell><Cell>0.027</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>N/A</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE18192</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>T192JWEL.0Y0H</FileName>
|
||||||
|
<HistogramStartTime>21:58:10</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2023-02-17</HistogramStartDate>
|
||||||
|
<HistogramStopTime>22:00:00</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2023-02-17</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>7.0 Volts</BatteryLevel>
|
||||||
|
<Calibration>September 15, 2022 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>Trumbull-Berkeley By.-Loc 2-85 Pennsyl</Project>
|
||||||
|
<Client>Trumbull Corporation</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc - D Harrison</UserName>
|
||||||
|
<SeisLoc>Loc #2- 85 Pennsylvania Lane</SeisLoc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>0.010</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>0.010</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>0.010</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>21:59:10</TranPeakTime>
|
||||||
|
<TranPeakDate>2023-02-17</TranPeakDate>
|
||||||
|
<VertPeakTime>21:59:10</VertPeakTime>
|
||||||
|
<VertPeakDate>2023-02-17</VertPeakDate>
|
||||||
|
<LongPeakTime>21:59:10</LongPeakTime>
|
||||||
|
<LongPeakDate>2023-02-17</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>0.014</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>21:59:10</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2023-02-17</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>120.0</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>21:59:10</MicLTime>
|
||||||
|
<MicLDate>2023-02-17</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>8.8</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.4 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>4.1</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.7 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.6</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.4 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>4.2</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>19.7 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>688 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Passed</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2023-02-17 21:58:09 - 2023-02-17 22:00:00 "Event Recorded Timer Stop"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2023-02-17 21:59:10</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.010</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.014</Cell><Cell>0.003</Cell><Cell>120.0</Cell><Cell>8.8</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+3204
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
+117
@@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE9558</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>K558KD43.NZ0H</FileName>
|
||||||
|
<HistogramStartTime>17:38:23</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2024-01-08</HistogramStartDate>
|
||||||
|
<HistogramStopTime>17:38:59</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2024-01-08</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.2 Volts</BatteryLevel>
|
||||||
|
<Calibration>May 31, 2023 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>CMU-RKM Hall-Loc 2-Museum-Scaife Gallery</Project>
|
||||||
|
<Client>PJ Dick Inc.</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc. - Harrison</UserName>
|
||||||
|
<Seis.Loc>Location #2 -Museum - Scaife Gallery</Seis.Loc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>1.830</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>4.935</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>3.925</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>16</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>51</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>8.0</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>17:38:59</TranPeakTime>
|
||||||
|
<TranPeakDate>2024-01-08</TranPeakDate>
|
||||||
|
<VertPeakTime>17:38:59</VertPeakTime>
|
||||||
|
<VertPeakDate>2024-01-08</VertPeakDate>
|
||||||
|
<LongPeakTime>17:38:59</LongPeakTime>
|
||||||
|
<LongPeakDate>2024-01-08</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>5.012</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>17:38:59</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2024-01-08</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>OORANGE</Value>
|
||||||
|
<Units></Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>17:38:59</MicLTime>
|
||||||
|
<MicLDate>2024-01-08</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>18</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.4 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>4.1</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.6 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.3</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.4 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>3.7</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Check</MicLTestResults>
|
||||||
|
<OORANGE>Out of Range</OORANGE>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2024-01-08 17:38:22 - 2024-01-08 17:38:59 "Event Recorded Modem Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2024-01-08 17:38:59</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>1.830</Cell><Cell>16</Cell><Cell>4.935</Cell><Cell>51</Cell><Cell>3.925</Cell><Cell>8.0</Cell><Cell>5.012</Cell><Cell>OORANGE</Cell><Cell>OORANGE</Cell><Cell>18</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+743
@@ -0,0 +1,743 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE11007</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>M007JC05.OI0H</FileName>
|
||||||
|
<HistogramStartTime>07:48:18</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2022-01-17</HistogramStartDate>
|
||||||
|
<HistogramStopTime>11:18:02</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2022-01-17</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>210.00</NumberofIntervals>
|
||||||
|
<IntervalSize>1 minute</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.8 Volts</BatteryLevel>
|
||||||
|
<Calibration>April 7, 2021 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>ECMS100607 - Loc 1 - 740 Washington Ave</Project>
|
||||||
|
<Client>J B Fay Co.</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc. - D. Harrison</UserName>
|
||||||
|
<SeisLoc>Location #1 - 740 Washington - Church</SeisLoc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>8.360</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>8.350</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>8.385</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>>100</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>11:18:02</TranPeakTime>
|
||||||
|
<TranPeakDate>2022-01-17</TranPeakDate>
|
||||||
|
<VertPeakTime>11:18:02</VertPeakTime>
|
||||||
|
<VertPeakDate>2022-01-17</VertPeakDate>
|
||||||
|
<LongPeakTime>11:18:02</LongPeakTime>
|
||||||
|
<LongPeakDate>2022-01-17</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>14.49</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>11:18:02</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2022-01-17</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>144.9</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>11:18:02</MicLTime>
|
||||||
|
<MicLDate>2022-01-17</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>1.7</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.5 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>3.9</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.5 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.7</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.5 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>4.2</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>20.5 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>574 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Passed</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2022-01-17 07:48:17 - 2022-01-17 11:18:02 "Event Recorded Modem Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2022-01-17 07:49:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:50:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:51:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:52:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:53:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:54:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:55:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:56:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:57:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:58:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 07:59:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:00:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:01:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:02:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:03:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:04:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:05:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:06:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:07:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:08:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:09:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:10:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:11:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:12:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:13:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:14:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:15:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:16:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:17:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:18:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:19:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:20:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:21:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:22:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:23:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:24:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:25:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:26:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:27:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:28:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.010</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:29:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:30:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:31:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:32:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:33:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:34:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:35:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:36:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:37:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:38:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:39:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:40:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:41:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:42:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:43:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:44:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:45:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:46:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:47:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:48:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:49:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:50:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:51:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:52:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:53:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:54:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:55:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:56:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:57:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:58:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 08:59:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:00:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:01:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:02:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:03:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:04:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:05:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:06:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:07:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:08:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:09:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:10:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:11:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:12:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:13:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:14:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:15:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:16:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:17:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:18:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:19:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:20:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:21:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:22:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>93.98</Cell><Cell>64</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:23:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:24:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:25:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:26:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:27:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:28:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:29:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:30:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:31:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:32:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:33:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:34:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:35:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.012</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:36:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:37:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:38:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:39:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:40:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:41:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:42:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:43:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:44:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:45:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:46:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:47:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:48:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:49:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:50:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:51:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:52:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:53:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:54:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:55:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:56:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:57:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:58:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 09:59:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.010</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:00:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:01:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:02:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:03:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:04:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:05:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:06:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:07:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:08:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:09:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:10:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:11:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:12:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:13:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:14:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:15:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:16:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:17:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:18:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:19:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:20:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:21:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:22:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:23:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.010</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:24:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:25:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:26:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:27:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:28:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:29:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:30:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:31:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:32:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:33:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:34:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:35:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:36:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:37:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:38:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:39:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:40:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:41:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:42:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:43:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:44:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:45:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:46:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:47:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:48:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:49:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:50:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:51:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:52:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:53:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:54:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:55:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:56:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:57:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.010</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:58:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 10:59:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:00:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:01:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:02:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:03:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:04:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:05:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:06:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:07:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:08:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:09:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:10:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:11:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>64</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:12:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:13:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:14:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:15:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.011</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:16:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.012</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:17:18</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>>100</Cell><Cell>0.005</Cell><Cell>>100</Cell><Cell>0.010</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>>100</Cell></Row>
|
||||||
|
<Time>2022-01-17 11:18:02</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>8.360</Cell><Cell>>100</Cell><Cell>8.350</Cell><Cell>>100</Cell><Cell>8.385</Cell><Cell>>100</Cell><Cell>14.49</Cell><Cell>0.051</Cell><Cell>144.9</Cell><Cell>1.7</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE13121</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>O121L4L1.GU0H</FileName>
|
||||||
|
<HistogramStartTime>18:17:18</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2025-06-25</HistogramStartDate>
|
||||||
|
<HistogramStopTime>18:19:31</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2025-06-25</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>5 minutes</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.4 Volts</BatteryLevel>
|
||||||
|
<Calibration>April 29, 2025 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>Fay - Locks & Dam No3- Loc3- 735 Bunola</Project>
|
||||||
|
<Client>Fay Company</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc - Harrison</UserName>
|
||||||
|
<SeisLoc>Loc. No 3 - 735 Bunola River Rd - Church</SeisLoc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>OORANGE</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>0.305</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>0.405</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>85</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>47</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>57</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>18:19:31</TranPeakTime>
|
||||||
|
<TranPeakDate>2025-06-25</TranPeakDate>
|
||||||
|
<VertPeakTime>18:19:31</VertPeakTime>
|
||||||
|
<VertPeakDate>2025-06-25</VertPeakDate>
|
||||||
|
<LongPeakTime>18:19:31</LongPeakTime>
|
||||||
|
<LongPeakDate>2025-06-25</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>OORANGE</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>18:19:31</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2025-06-25</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>123.4</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>18:19:31</MicLTime>
|
||||||
|
<MicLDate>2025-06-25</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>85</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.3 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>4.0</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.7 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.6</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.6 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>3.6</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Check</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2025-06-25 18:17:17 - 2025-06-25 18:19:31 "Event Recorded Modem Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2025-06-25 18:19:31</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>OORANGE</Cell><Cell>85</Cell><Cell>0.305</Cell><Cell>47</Cell><Cell>0.405</Cell><Cell>57</Cell><Cell>OORANGE</Cell><Cell>0.004</Cell><Cell>123.4</Cell><Cell>85</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
BIN
Binary file not shown.
+116
@@ -0,0 +1,116 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Event>
|
||||||
|
<FileVersion>8.0</FileVersion>
|
||||||
|
<EventType>Full Histogram</EventType>
|
||||||
|
<SerialNumber>BE9558</SerialNumber>
|
||||||
|
<Version>V 10.72-8.17 MiniMate Plus</Version>
|
||||||
|
<FileName>K558L4KY.440H</FileName>
|
||||||
|
<HistogramStartTime>17:04:52</HistogramStartTime>
|
||||||
|
<HistogramStartDate>2025-06-25</HistogramStartDate>
|
||||||
|
<HistogramStopTime>17:05:39</HistogramStopTime>
|
||||||
|
<HistogramStopDate>2025-06-25</HistogramStopDate>
|
||||||
|
<Channels>
|
||||||
|
<Channel>Tran</Channel>
|
||||||
|
<Channel>Vert</Channel>
|
||||||
|
<Channel>Long</Channel>
|
||||||
|
<Channel>MicL</Channel>
|
||||||
|
</Channels>
|
||||||
|
<NumberofIntervals>1.00</NumberofIntervals>
|
||||||
|
<IntervalSize>5 minutes</IntervalSize>
|
||||||
|
<SampleRate>1024 sps</SampleRate>
|
||||||
|
<BatteryLevel>6.3 Volts</BatteryLevel>
|
||||||
|
<Calibration>June 13, 2025 by Instantel</Calibration>
|
||||||
|
<Units>in/s and dB(L)</Units>
|
||||||
|
<Project>Fay - Locks & Dam No3 -Loc 5 Synthomer</Project>
|
||||||
|
<Client>Fay Company</Client>
|
||||||
|
<UserName>Terra-Mechanics Inc - Harrison</UserName>
|
||||||
|
<Seis.Loc>Location #5 Sythomer Plant</Seis.Loc>
|
||||||
|
<GeoRange>
|
||||||
|
<Value>10.000</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</GeoRange>
|
||||||
|
<TranPPV>
|
||||||
|
<Value>2.315</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</TranPPV>
|
||||||
|
<VertPPV>
|
||||||
|
<Value>2.715</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</VertPPV>
|
||||||
|
<LongPPV>
|
||||||
|
<Value>5.115</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</LongPPV>
|
||||||
|
<TranZCFreq>
|
||||||
|
<Value>10</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</TranZCFreq>
|
||||||
|
<VertZCFreq>
|
||||||
|
<Value>85</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</VertZCFreq>
|
||||||
|
<LongZCFreq>
|
||||||
|
<Value>19</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</LongZCFreq>
|
||||||
|
<TranPeakTime>17:05:39</TranPeakTime>
|
||||||
|
<TranPeakDate>2025-06-25</TranPeakDate>
|
||||||
|
<VertPeakTime>17:05:39</VertPeakTime>
|
||||||
|
<VertPeakDate>2025-06-25</VertPeakDate>
|
||||||
|
<LongPeakTime>17:05:39</LongPeakTime>
|
||||||
|
<LongPeakDate>2025-06-25</LongPeakDate>
|
||||||
|
<PeakVectorSum>
|
||||||
|
<Value>5.559</Value>
|
||||||
|
<Units>in/s</Units>
|
||||||
|
</PeakVectorSum>
|
||||||
|
<PeakVectorSumTime>17:05:39</PeakVectorSumTime>
|
||||||
|
<PeakVectorSumDate>2025-06-25</PeakVectorSumDate>
|
||||||
|
<Microphone>Linear Weighting</Microphone>
|
||||||
|
<MicLPSPL>
|
||||||
|
<Value>111.8</Value>
|
||||||
|
<Units>dB(L)</Units>
|
||||||
|
</MicLPSPL>
|
||||||
|
<MicLTime>17:05:39</MicLTime>
|
||||||
|
<MicLDate>2025-06-25</MicLDate>
|
||||||
|
<MicLZCFreq>
|
||||||
|
<Value>43</Value>
|
||||||
|
<Units>Hz</Units>
|
||||||
|
</MicLZCFreq>
|
||||||
|
<TranTestFreq>7.7 Hz.</TranTestFreq>
|
||||||
|
<TranTestRatio>3.9</TranTestRatio>
|
||||||
|
<TranTestResults>Passed</TranTestResults>
|
||||||
|
<VertTestFreq>7.5 Hz.</VertTestFreq>
|
||||||
|
<VertTestRatio>3.8</VertTestRatio>
|
||||||
|
<VertTestResults>Passed</VertTestResults>
|
||||||
|
<LongTestFreq>7.5 Hz.</LongTestFreq>
|
||||||
|
<LongTestRatio>3.7</LongTestRatio>
|
||||||
|
<LongTestResults>Passed</LongTestResults>
|
||||||
|
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
|
||||||
|
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
|
||||||
|
<MicLTestResults>Check</MicLTestResults>
|
||||||
|
<UsbSummaryChannels>
|
||||||
|
</UsbSummaryChannels>
|
||||||
|
<MonitorLog>2025-06-25 17:04:51 - 2025-06-25 17:05:39 "Event Recorded Modem Exit"</MonitorLog>
|
||||||
|
<HistogramData>
|
||||||
|
<HistogramDataColumnTitle>
|
||||||
|
<ColumnTitle> Tran Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Tran Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Vert Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Peak in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> Long Freq Hz </ColumnTitle>
|
||||||
|
<ColumnTitle> Geo PVS in/s </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
|
||||||
|
<ColumnTitle> MicL Freq Hz </ColumnTitle>
|
||||||
|
</HistogramDataColumnTitle>
|
||||||
|
<HistogramDataIntervals>
|
||||||
|
<Time>2025-06-25 17:05:39</Time>
|
||||||
|
<Row>
|
||||||
|
<Cell>2.315</Cell><Cell>10</Cell><Cell>2.715</Cell><Cell>85</Cell><Cell>5.115</Cell><Cell>19</Cell><Cell>5.559</Cell><Cell>0.001</Cell><Cell>111.8</Cell><Cell>43</Cell></Row>
|
||||||
|
</HistogramDataIntervals>
|
||||||
|
</HistogramData>
|
||||||
|
<HistogramDataUsbChannels>
|
||||||
|
</HistogramDataUsbChannels>
|
||||||
|
|
||||||
|
</Event>
|
||||||
Loaded 100 of 153 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user