diff --git a/CLAUDE.md b/CLAUDE.md index d57b2ad..4ca43e4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -45,13 +45,28 @@ Read this first when picking the project back up. - **Byte layouts** of every field read from the file: `docs/instantel_protocol_reference.md` Appendix **D.6**. - **Where the decoder stands on `dev`** (2026-11-03, run `20261103-121047`): - **18 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. + **Where the decoder stands on `dev`** (2026-11-03, run `20261103-140229`): + **28 of 88 fields match on every event**, up from about 6 before v0.33.0. + The five `dev` fixes below share one release and one backfill. - โœ… **Match on every event:** - 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 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 + - ๐Ÿ”‘ **"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 year (`dev`; v0.33.0 had 6,491, its 33 others being Sensitive-range events read 8ร— high). @@ -72,8 +87,7 @@ Read this first when picking the project back up. - 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): - - **A. Setup fields:** trigger source and levels, stop mode, mic type, - display units, firmware version, serial number, calibration, battery. + - ~~**A. Setup fields**~~ โœ… done on `dev`. - **B. Histogram interval detail:** per-interval frequencies (#50: they assume 1024 sps), per-interval PVS, interval size, stop time. - **C. #51 timing:** start time, per-interval times, peak times. diff --git a/README.md b/README.md index 869c5e2..3e4724d 100644 --- a/README.md +++ b/README.md @@ -632,16 +632,17 @@ Implementation steps (concrete): 3. flip ingest so reports are kept only for checking (retire the overlay) 4. stop the watchers forwarding reports - **Done so far: 18 of 88 report fields match on every DL2 event.** + **Done so far: 28 of 88 report fields match on every DL2 event.** - In v0.33.0: setup fields, notes, event type, histogram PVS, mic. - On `dev`: - the geophone range - the job number - histograms that decoded wrongly - the footer: no more day-late histograms; every waveform time exact + - serial, version, calibration, battery, trigger source and levels, stop mode, mic type + - A Blastware report's dB/psi is its PC's preference, not anything in the event file: a carve-out. **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 diff --git a/docs/instantel_protocol_reference.md b/docs/instantel_protocol_reference.md index 0240e0e..3a29aa7 100644 --- a/docs/instantel_protocol_reference.md +++ b/docs/instantel_protocol_reference.md @@ -11,6 +11,7 @@ | Date | Section | Change | |---|---|---| +| 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-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-10-26 (5) | ยง7.8.9 | โœ… **The embedded event record: the instrument's trigger time, inside the 5A stream.** Every Blastware waveform file carries `00 28 05 00 ?? ?? fe 80 [trigger 8 B][stop 8 B]`, times as `dd mm yyyy(BE) 00 hh mm ss`. The trigger equals Blastware's report 1,320/1,320, the filename 7,935/7,935 and the unit's 0C record 10/10. It occurs once in the unit's own A5 payloads (8/8 events) and in SFM-only downloads (2/2): instrument data, not Blastware's. The footer's `ts2 - record time` is only an estimate, a second off on ~19%. Decoder rule, validation and an open case (3 waveform-named files the codec does not recognise) in ยง7.8.9. ๐Ÿ”ถ The ยง7.5 `0C` "sub_code" timestamp variants look like the same 8-byte form read with its escapes. | @@ -3789,12 +3790,80 @@ Each interval stores its peak vector sum **squared**: - **Verified:** interval psi mismatches fell from 42,783 to 26, and mic peak mismatches from 345 to 40. -#### D.6.7 Not read from the file yet +**Three things share the word "units". Keep them apart** (2026-11-03): -*Updated 2026-11-03. 18 of 88 report fields now match on every DL2 event.* +| 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 Not read from the file yet + +*Updated 2026-11-03. 28 of 88 report fields now match on every DL2 event.* - **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 @@ -3811,6 +3880,8 @@ Each interval stores its peak vector sum **squared**: - the 26 histogram start dates a day off (D.3.3; 17 of them were the same 5 s files, timed as waveforms) - the job number (D.6.3) + - identity, battery, trigger source and trigger settings (D.6.8); Units is Blastware's + preference (D.6.6) ---