# Demodulator data format - physical value :id=top

------

> _Doc Ver:_ 1.10  
_App Ver:_ 2.6.6.53  
_Date:_ 09/14/2026

------

New saves write two files. Default is the original SA1 dialect. Data save **1.11** (`DS_SAVE_PROTO=1`) writes SA2 v1.7 instead ([`0x10`](data-wl-v1.7.md) / [`0x15`](data-pv-v1.7.md)). Live `:DATA:PV?` stays original.

- `persist/data/wl/{idn}_{sn}-wl-{YYYYMMDD}_{HHMMSSNNN}[_{end}].dat` — version `0x00` (or `0x10`)
- `persist/data/pv/{idn}_{sn}-pv-{YYYYMMDD}_{HHMMSSNNN}[_{end}].dat` — version `0x04`/`0x05` (or `0x15`)

On-device `sa-file info|csv` reads these. Legacy `data/rt/` stays listed. Uploaded files land in `inbox/` and can play back if they are wavelength frames. Optional raw UDP capture is `persist/data/raw/` ([SA_DATA_FILE v1.0](data-rawfile.md)); `sa-file csv --kind raw`.

After [precise wavelength calibration](precise_wl.md) is enabled, wavelengths here are calibrated. Verify live with `:DATA:PVJ?` / `get_phy_data.php`, not `:DATA:PV?`.

**Mode (from 2.6.6.17):** `0` writes wl first, then complete `0x04`/`0x05` (or `0x15` if Save protocol is 1) to `pv/` after compute when Save physical value is on. `1` skips compute and pv. `2` is full-speed sa-ds. Old Mode 1 becomes new `0` on upgrade.

**Before 2.6.6.14:** Mode 1 `pv/` files often have only a `0x21` register. `sa-file info` shows `frames=0`. Those closed files cannot be recovered.

**CSV** (Data page / `sa-file csv --kind pv`) matches SA2. Header once:

```
ISO时间,Unix时间,计数器,ID,通道,错误码,波长,物理值,阈值报警,变化率报警
```

Then one row per frame: `{local ISO}.{usec6},{unix}.{usec6},{counter}` plus 7-tuples `{ID},{ch},{err},{wl},{pv},{alert},{speed}` sorted by ID. Original `0x04` stores `wl − 1_500_000`; export adds `1_500_000`. SA2 `0x15` already stores absolute pm (do not add again). `0x04` has one alarm byte → 阈值报警; 变化率报警 is `0`. `0x15` fills both alarm columns.

## Physical value data format :id=title

|#|Number|Field name|Bytes|Value|Description|
|:-:|:-:|----------|:-:|:------:|--------------------|
1|1|Start identifier|4|0xFFFFFFFF|
2|2|Data version|1|0x00|Wavelength mode
3||||0x01|Spectrum mode (4096 voltage type)
4||||0x02|Combined wavelength and spectrum mode
5||||0x03|Physical value mode
6||Physical value data uses this value||0x04|Wavelength and physical value
7||Physical value data uses this value (including virtual)||0x05|Wavelength, physical value, and virtual physical value
8||||0x20|Standard sensor configuration
9||||0x21|Standard sensor and virtual sensor configuration
10||||0x22|Sensor precision calibration parameter configuration
11||||0x23|Sensor warning and alarm configuration
12|3|Checksum|1|0x00|Checksum reserved
13|4|Device serial number|4||If there is no serial number, these 4 bytes are 0.
14|5|Device time|4|Second|Unix Time seconds format. If there is no built-in time, these 4 bytes are 0.
15|||4|Microsecond|
16|6|Counter|4|Counter|Internal counter; wraps to zero when it increments past the maximum.
17|7|Device status|4|0x00000000|No sensor data, no fault. If there is no sensor data, fields after item 7 are not output except the end identifier.
18||||0x00000001|Sensor data present, device normal
20||||0x00000002|Built-in laser thermometer fault
21||||0x00000004|Laser temperature abnormal
22||||0x00000008|Laser fault
24||||0x00000010|Device thermometer fault
25||||0x00000020|Device temperature abnormal
26||||0x00000040|Device hygrometer fault
27||||0x00000080|Device humidity abnormal
28||||0x00000100|Device vibration sensor fault
29||||0x00000200|Device excessive vibration fault
30||||0x00000400|Device temperature-control abnormal
31||||0x00000800|Device supply voltage abnormal
33||||0x00001000|Detector fault; fault channels are reported in '8 Device status 2'.
34||||0x00002000|Fiber optical-path fault; fault channels are reported in '8 Device status 2'.
35||||0x00004000|Channel threshold adjustment abnormal; fault channels are reported in '8 Device status 2'.
37||||0x00010000|Insufficient CPU computing power
38||||0x00020000|Data output busy/blocked
39||||0x00040000|Insufficient computing space
40||||0x00080000|Insufficient storage space
42||||0x00100000|Data serial-port fault
43||||0x00200000|Network-port fault
44||||0x00400000|Indicator-lamp fault; indicator type is reported in '8 Device status 2'.
45||||0x00800000|Key fault; key type is reported in '8 Device status 2'.
46||||0x01000000|Display output device fault
48||||0x10000000|FBG sensor missing alarm; missing count is reported in '8 Device status 2'.
49||||0x20000000|FBG sensor warning; warning count is reported in '8 Device status 2'.
50||||0x40000000|FBG sensor critical alarm; alarm count is reported in '8 Device status 2'.
52||||0x80000000|Unknown fault
53|8|Device status 2|4||Supplements the device status information, for example which detector has a problem and how many sensor alarms.
54|9|Laser temperature|4||4byte float
55|10|System valid channel count|1||
56|11|Sensor count per channel|32||Wavelength mode: each byte is the sensor count of each channel in order.
57|12|FBG wavelength data|4*N||4byte float, 2 digits after the decimal point. Wavelength data = wavelength-1500000.
58|13|End/interval identifier|4|0xFEFEFEFE|
59|14|ID array|2*N||short; N is the total number of sensors; 0 is an unmatched sensor.
60|15|Physical value|4*N||float; this data layout is convenient for data compression.
61|16|Error level|1*N||char
62|17|Alarm level|1*N||char
63|18|End/interval identifier|4|0xFDFDFDFD|
64|19|Virtual sensor count|1||char; if 0, there is no data or it is not enabled; M is the count.
65|20|ID array|2*M||short; M is the total number of virtual sensors; 0 is an unmatched sensor.
66|21|Physical value|4*M||float; this data layout is convenient for data compression.
67|22|Error level|1*M||char
68|23|Alarm level|1*M||char
69|24|End/interval identifier|4|0xFCFCFCFC|


## Change log :id=changelog

|Version|Date|Description|
|:--:|----|----------|
|1.10|09/14/2026|1. Optional SA2 v1.7 on-disk `0x15` via `DS_SAVE_PROTO`. `sa-file` reads both. Live stays original.|
|1.9|09/07/2026|1. Mode 0/1/2 (2.6.6.17). Mode 0 writes pv after compute. Old Mode 1 becomes 0.|
|1.8|09/07/2026|1. Mode 1 writes 0x04/0x05 after compute (2.6.6.14). SA2 PV CSV columns. Old Mode 1 files stay empty.|
|1.7|09/06/2026|1. Split wl/pv on-disk files; frames unchanged.|
|1.6|03/03/2022|1. Created help using the new file format.|

------

[Top](#top)
